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