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