Check table before creating

This commit is contained in:
Pig Fang 2019-04-19 23:05:58 +08:00
parent 228c2df73e
commit ff4fa1eefa

View File

@ -8,15 +8,17 @@ class CreateReportTable extends Migration
{
public function up()
{
Schema::create('reports', function (Blueprint $table) {
$table->increments('id');
$table->integer('tid');
$table->integer('uploader');
$table->integer('reporter');
$table->longText('reason');
$table->integer('status');
$table->dateTime('report_at');
});
if (! Schema::hasTable('reports')) {
Schema::create('reports', function (Blueprint $table) {
$table->increments('id');
$table->integer('tid');
$table->integer('uploader');
$table->integer('reporter');
$table->longText('reason');
$table->integer('status');
$table->dateTime('report_at');
});
}
}
public function down()