35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
||
|
||
use Illuminate\Database\Migrations\Migration;
|
||
use Illuminate\Database\Schema\Blueprint;
|
||
use Illuminate\Support\Facades\Schema;
|
||
|
||
return new class extends Migration
|
||
{
|
||
/**
|
||
* Run the migrations.
|
||
*/
|
||
public function up(): void
|
||
{
|
||
Schema::create('management', function (Blueprint $table) {
|
||
$table->id('management_id'); // 主キー、AUTO_INCREMENT, NOT NULL
|
||
$table->string('management_name', 255); // varchar(255), NOT NULL
|
||
$table->string('management_code', 10)->unique(); // varchar(10), NOT NULL, UNIQUE
|
||
$table->boolean('municipality_flag')->nullable(); // tinyint(1), NULL
|
||
$table->boolean('government_approval_required')->nullable(); // tinyint(1), NULL
|
||
$table->boolean('valid_flag '); // tinyint(1)
|
||
$table->timestamps(); // created_at, updated_at (datetime), NOT NULL
|
||
$table->unsignedInteger('operator_id')->nullable(); // int(10), NULL
|
||
$table->foreign('operator_id')->references('ope_id')->on('ope'); // 外部キー(opeテーブルのope_idを参照)
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Reverse the migrations.
|
||
*/
|
||
public function down(): void
|
||
{
|
||
Schema::dropIfExists('management');
|
||
}
|
||
};
|