<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use ModStart\Core\Dao\ModelManageUtil; class CreateNews extends Migration { public function up() { if (ModelManageUtil::hasTable('news')) { goto gQg4m; BUF2S: if (!in_array('categoryId', $foNFK)) { Schema::table('news', function (Blueprint $fnOXp) { $fnOXp->integer('categoryId')->nullable()->comment(''); }); } goto N5dIM; N5dIM: if (!in_array('cover', $foNFK)) { Schema::table('news', function (Blueprint $fnOXp) { $fnOXp->string('cover', 200)->nullable()->comment(''); }); } goto YHqkh; gQg4m: $foNFK = ModelManageUtil::listTableColumns('news'); goto BUF2S; YHqkh: if (!in_array('summary', $foNFK)) { Schema::table('news', function (Blueprint $fnOXp) { $fnOXp->string('summary', 200)->nullable()->comment(''); }); } goto PDIKO; PDIKO: } else { Schema::create('news', function (Blueprint $fnOXp) { $fnOXp->increments('id'); $fnOXp->timestamps(); $fnOXp->integer('categoryId')->nullable()->comment(''); $fnOXp->string('title', 200)->nullable()->comment(''); $fnOXp->string('cover', 200)->nullable()->comment(''); $fnOXp->string('summary', 200)->nullable()->comment(''); $fnOXp->text('content')->nullable()->comment(''); }); } } public function down() { } }