<?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 Qer2J; Qer2J: $nmfE0 = ModelManageUtil::listTableColumns('nav'); goto AdB5a; LrO3g: if (!in_array('name', $nmfE0)) { if (in_array('title', $nmfE0)) { Schema::table('nav', function (Blueprint $GocOS) { $GocOS->renameColumn('title', 'name'); }); } else { Schema::table('nav', function (Blueprint $GocOS) { $GocOS->string('name', 100)->nullable()->comment('图片'); }); } } goto w0dV0; w0dV0: if (!in_array('link', $nmfE0)) { if (in_array('url', $nmfE0)) { Schema::table('nav', function (Blueprint $GocOS) { $GocOS->renameColumn('url', 'link'); }); } else { Schema::table('nav', function (Blueprint $GocOS) { $GocOS->string('link', 200)->nullable()->comment('链接'); }); } } goto Xui1X; AdB5a: if (!in_array('position', $nmfE0)) { if (in_array('type', $nmfE0)) { Schema::table('nav', function (Blueprint $GocOS) { $GocOS->renameColumn('type', 'position'); }); } else { Schema::table('nav', function (Blueprint $GocOS) { $GocOS->string('position', 50)->nullable()->comment('位置'); }); } } goto LrO3g; Xui1X: } else { Schema::create('nav', function (Blueprint $GocOS) { $GocOS->increments('id'); $GocOS->timestamps(); $GocOS->string('position', 50)->nullable()->comment('位置'); $GocOS->integer('sort')->nullable()->comment('顺序'); $GocOS->string('name', 100)->nullable()->comment('图片'); $GocOS->string('link', 200)->nullable()->comment('链接'); }); } } public function down() { } }