program dan basis data ekosistem

This commit is contained in:
2026-04-20 16:05:27 +07:00
parent 0bbcb22d50
commit 4032eb6e75
49 changed files with 4384 additions and 155 deletions
@@ -18,7 +18,7 @@ return new class extends Migration
$table->foreignId('profile_id')->constrained('profiles');
$table->foreignId('keluarga_pengelola_id')->nullable()->constrained('keluarga')->onDelete('set null');
$table->foreignId('adat_pemilik_id')->nullable()->constrained('keluarga')->onDelete('set null');
$table->foreignId('adat_pemilik_id')->nullable()->constrained('adat')->onDelete('set null');
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan');
$table->text('path')->nullable();
@@ -0,0 +1,42 @@
<?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::table('map_lahan', function (Blueprint $table) {
$table->jsonb('path')->nullable()->change();
});
Schema::table('master_provinsi', function (Blueprint $table) {
$table->jsonb('path')->nullable()->change();
});
Schema::table('master_kabupaten_kota', function (Blueprint $table) {
$table->jsonb('path')->nullable()->change();
});
Schema::table('master_kecamatan', function (Blueprint $table) {
$table->jsonb('path')->nullable()->change();
});
Schema::table('master_desa_kelurahan', function (Blueprint $table) {
$table->jsonb('path')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
}
};
@@ -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('core_program', function (Blueprint $table) {
$table->id();
$table->string('nama');
$table->string('sub_domain');
$table->integer('tahun');
$table->string('instansi')->nullable();
$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('core_program_komoditas', function (Blueprint $table) {
$table->id();
$table->foreignId('program_id')->nullable()->constrained('core_program')->nullOnDelete();
$table->foreignId('komoditas_id')->nullable()->constrained('master_komoditas')->nullOnDelete();
$table->boolean('default')->default(false);
$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('core_program_lokasi', function (Blueprint $table) {
$table->id();
$table->foreignId('program_id')->nullable()->constrained('core_program')->nullOnDelete();
$table->foreignId('provinsi_id')->nullable()->constrained('master_provinsi')->nullOnDelete();
$table->foreignId('kabupaten_kota_id')->nullable()->constrained('master_kabupaten_kota')->nullOnDelete();
$table->foreignId('kecamatan_id')->nullable()->constrained('master_kecamatan')->nullOnDelete();
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan')->nullOnDelete();
$table->boolean('default')->default(false);
$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();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('core_program_lokasi');
Schema::dropIfExists('core_program_komoditas');
Schema::dropIfExists('core_program');
}
};
@@ -0,0 +1,82 @@
<?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('ekosistem_basis_data_tabel', function (Blueprint $table) {
$table->id();
$table->string('tabel')->unique();
$table->string('label');
$table->string('menu');
$table->string('deskripsi', 1000)->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('ekosistem_basis_data_kolom', function (Blueprint $table) {
$table->id();
$table->foreignId('tabel_id')->constrained('ekosistem_basis_data_tabel')->restrictOnDelete();
$table->string('kolom');
$table->string('label');
$table->enum('tipe', ['varchar', 'integer', 'float', 'boolean', 'date', 'datetime', 'text'])->default('varchar');
$table->jsonb('validasi')->nullable();
$table->integer('urutan')->default(1);
$table->timestamps();
$table->softDeletes();
});
DB::statement("
CREATE UNIQUE INDEX ekosistem_basis_data_kolom_unique_active
ON ekosistem_basis_data_kolom (tabel_id, kolom)
WHERE deleted_at IS NULL
");
Schema::create('ekosistem_basis_data_value', function (Blueprint $table) {
$table->id();
$table->foreignId('program_id')->constrained('core_program')->restrictOnDelete();
$table->foreignId('tabel_id')->constrained('ekosistem_basis_data_tabel')->restrictOnDelete();
$table->foreignId('kolom_id')->constrained('ekosistem_basis_data_kolom')->restrictOnDelete();
$table->string('value_id');
$table->string('value_varchar')->nullable();
$table->integer('value_integer')->nullable();
$table->float('value_float', 10, 2)->nullable();
$table->boolean('value_boolean')->nullable();
$table->date('value_date')->nullable();
$table->datetime('value_datetime')->nullable();
$table->text('value_text')->nullable();
$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();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ekosistem_basis_data_value');
Schema::dropIfExists('ekosistem_basis_data_kolom');
Schema::dropIfExists('ekosistem_basis_data_tabel');
}
};
@@ -0,0 +1,25 @@
<?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::table('profiles', function (Blueprint $table) {
$table->foreignId('adat_id')->nullable()->constrained('adat');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
}
};
@@ -0,0 +1,53 @@
<?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('ekosistem_basis_data_group', function (Blueprint $table) {
$table->id();
$table->string('group')->unique();
$table->string('label');
$table->integer('urutan')->default(1);
$table->string('deskripsi', 1000)->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('deleted_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->softDeletes();
});
Schema::table('ekosistem_basis_data_tabel', function (Blueprint $table) {
$table->foreignId('group_id')->nullable()->constrained('ekosistem_basis_data_group')->nullOnDelete();
$table->integer('urutan')->default(1);
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('deleted_by')->nullable()->constrained('users')->nullOnDelete();
});
Schema::table('ekosistem_basis_data_kolom', function (Blueprint $table) {
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('deleted_by')->nullable()->constrained('users')->nullOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ekosistem_basis_data_group');
}
};