<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use ModStart\Core\Dao\ModelManageUtil; class CreateNav extends Migration { public function up() { if (ModelManageUtil::hasTable('nav')) { goto fbCNj; qktR4: if (!in_array('link', $DdAUN)) { if (in_array('url', $DdAUN)) { Schema::table('nav', function (Blueprint $onV5E) { $onV5E->renameColumn('url', 'link'); }); } else { Schema::table('nav', function (Blueprint $onV5E) { $onV5E->string('link', 200)->nullable()->comment('链接'); }); } } goto szNYM; sNInZ: if (!in_array('position', $DdAUN)) { if (in_array('type', $DdAUN)) { Schema::table('nav', function (Blueprint $onV5E) { $onV5E->renameColumn('type', 'position'); }); } else { Schema::table('nav', function (Blueprint $onV5E) { $onV5E->string('position', 50)->nullable()->comment('位置'); }); } } goto IT2BK; fbCNj: $DdAUN = ModelManageUtil::listTableColumns('nav'); goto sNInZ; IT2BK: if (!in_array('name', $DdAUN)) { if (in_array('title', $DdAUN)) { Schema::table('nav', function (Blueprint $onV5E) { $onV5E->renameColumn('title', 'name'); }); } else { Schema::table('nav', function (Blueprint $onV5E) { $onV5E->string('name', 100)->nullable()->comment('图片'); }); } } goto qktR4; szNYM: } else { Schema::create('nav', function (Blueprint $onV5E) { $onV5E->increments('id'); $onV5E->timestamps(); $onV5E->string('position', 50)->nullable()->comment('位置'); $onV5E->integer('sort')->nullable()->comment('顺序'); $onV5E->string('name', 100)->nullable()->comment('图片'); $onV5E->string('link', 200)->nullable()->comment('链接'); }); } } public function down() { } }