<?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 $onV5E) { $onV5E->tinyInteger('type')->nullable()->comment(''); if (!\ModStart\Core\Dao\ModelManageUtil::hasTableColumn('banner', 'title')) { $onV5E->string('title', 100)->nullable()->comment(''); } $onV5E->string('slogan', 200)->nullable()->comment(''); $onV5E->string('linkText', 20)->nullable()->comment(''); $onV5E->tinyInteger('colorReverse')->nullable()->comment(''); }); foreach (ModelUtil::all('banner') as $YaV4m) { ModelUtil::update('banner', $YaV4m['id'], array('type' => BannerType::IMAGE)); } } public function down() { } }