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