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