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