46 lines
1.0 KiB
PHP
46 lines
1.0 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('master_provinsi', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->timestamps();
|
|
|
|
$table->softDeletes();
|
|
|
|
$table->string('nama');
|
|
$table->string('kode', 2);
|
|
});
|
|
|
|
Schema::create('master_kabupaten_kota', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->timestamps();
|
|
|
|
$table->softDeletes();
|
|
|
|
$table->string('nama');
|
|
$table->string('kode', 4);
|
|
|
|
$table->foreignId('provinsi_id')->constrained('master_provinsi');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('master_kabupaten_kota');
|
|
Schema::dropIfExists('master_provinsi');
|
|
}
|
|
};
|