75 lines
3.4 KiB
PHP
75 lines
3.4 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->string('kode_provinsi', 10)->unique();
|
|
$table->string('nama_provinsi', 100);
|
|
$table->string('path', 10000);
|
|
$table->string('iso', 100);
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
|
|
Schema::create('master_kabupaten_kota', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('kode_kabupaten_kota', 10)->unique();
|
|
$table->string('nama_kabupaten_kota', 100);
|
|
$table->string('path', 10000);
|
|
$table->foreignId('provinsi_id')->constrained('master_provinsi')->onDelete('set null');
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
|
|
Schema::create('master_kecamatan', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('kode_kecamatan', 10)->unique();
|
|
$table->string('nama_kecamatan', 100);
|
|
$table->string('path', 10000);
|
|
$table->foreignId('kabupaten_kota_id')->constrained('master_kabupaten_kota')->onDelete('set null');
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
|
|
Schema::create('master_desa_kelurahan', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('kode_desa_kelurahan', 10)->unique();
|
|
$table->string('nama_desa_kelurahan', 100);
|
|
$table->string('path', 10000);
|
|
$table->foreignId('kecamatan_id')->constrained('master_kecamatan')->onDelete('set null');
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('master_desa_kelurahan');
|
|
Schema::dropIfExists('master_kecamatan');
|
|
Schema::dropIfExists('master_kabupaten_kota');
|
|
Schema::dropIfExists('master_provinsi');
|
|
}
|
|
};
|