39 行
1.0 KiB
PHP
39 行
1.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateJapanPrefecturesTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('japan_prefectures', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('island_id');
|
|
$table->foreign('island_id')->references('id')->on('japan_islands');
|
|
$table->unsignedBigInteger('capital');
|
|
$table->foreign('capital')->references('id')->on('japan_cities');
|
|
$table->string('name', 255)->nullable();
|
|
$table->string('nameKana', 255)->nullable();
|
|
$table->string('nameEng', 255)->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('japan_prefectures');
|
|
}
|
|
}
|