Update Master Data

This commit is contained in:
2026-02-20 00:06:06 +07:00
parent 21ad516dce
commit 66c8bb6810
99 changed files with 67783 additions and 306 deletions
@@ -6,11 +6,8 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
@@ -18,7 +15,22 @@ return new class extends Migration
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$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('user_roles', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->unique()->constrained('users')->onDelete('cascade');
$table->enum('role_name', ['Super Admin', 'Admin', 'Koordinator', 'Penyuluh', 'Pendamping', 'Petani'])->default('Petani');
$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('password_reset_tokens', function (Blueprint $table) {
@@ -37,12 +49,10 @@ return new class extends Migration
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('user_roles');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
@@ -0,0 +1,74 @@
<?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');
}
};