vd/database/migrations/2018_12_24_164210_create_blocs_table.php
2018-12-24 17:43:48 +08:00

47 lines
1.2 KiB
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBlocsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasTable('blocs')) {
return;
}
Schema::create('blocs', function (Blueprint $table) {
$table->increments('id')->comment('集团ID');
$table->string('sn', 32)->comment('集团编号');
$table->string('name', 32)->comment('集团名称');
$table->string('shorthand', 32)->comment('英文简称');
$table->tinyInteger('carrier_operator')->unsigned()->default(255)->comment('运营商(0:联通 1:移动 2:电信)');
$table->timestamps();
$table->softDeletes();
$table->unique(['sn', 'deleted_at']);
$table->index('name');
$table->index('carrier_operator');
$table->comment('卡源集团');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('blocs');
}
}