<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use ModStart\Core\Dao\ModelManageUtil; class CreateNewsCategory extends Migration { public function up() { if (ModelManageUtil::hasTable('news_category')) { $foNFK = ModelManageUtil::listTableColumns('news_category'); if (in_array('name', $foNFK)) { Schema::table('news_category', function (Blueprint $fnOXp) { $fnOXp->renameColumn('name', 'title'); }); } } else { Schema::create('news_category', function (Blueprint $fnOXp) { $fnOXp->increments('id'); $fnOXp->timestamps(); $fnOXp->integer('pid')->nullable()->comment(''); $fnOXp->integer('sort')->nullable()->comment(''); $fnOXp->string('title', 20)->nullable()->comment(''); }); } } public function down() { } }