관리-도구
편집 파일: 2020_12_05_114650_create_districts_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateDistrictsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('districts', function (Blueprint $table) { $table->id(); $table->string('dist_id', 2); $table->string('dist_name', 100); $table->string('en_name')->nullable(); $table->unsignedBigInteger('province_id')->nullable(); $table->timestamps(); $table->foreign('province_id')->references('id')->on('provinces')->onDelete('SET NULL')->onUpdate('CASCADE'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('districts'); } }