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