<?php
 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')) { $columns = ModelManageUtil::listTableColumns('news_category'); if (in_array('name', $columns)) { Schema::table('news_category', function (Blueprint $table) { $table->renameColumn('name', 'title'); }); } } else { Schema::create('news_category', function (Blueprint $table) { $table->increments('id'); $table->timestamps(); $table->integer('pid')->nullable()->comment(''); $table->integer('sort')->nullable()->comment(''); $table->string('title', 20)->nullable()->comment(''); }); } } public function down() { } } 