<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use ModStart\Core\Dao\ModelUtil; use Module\Banner\Type\BannerType; class ModifyBannerAddType extends Migration { public function up() { Schema::table('banner', function (Blueprint $fnOXp) { $fnOXp->tinyInteger('type')->nullable()->comment(''); if (!\ModStart\Core\Dao\ModelManageUtil::hasTableColumn('banner', 'title')) { $fnOXp->string('title', 100)->nullable()->comment(''); } $fnOXp->string('slogan', 200)->nullable()->comment(''); $fnOXp->string('linkText', 20)->nullable()->comment(''); $fnOXp->tinyInteger('colorReverse')->nullable()->comment(''); }); foreach (ModelUtil::all('banner') as $qgfZ7) { ModelUtil::update('banner', $qgfZ7['id'], array('type' => BannerType::IMAGE)); } } public function down() { } }