Update Migration & Seeder

This commit is contained in:
2026-05-26 09:38:38 +07:00
parent 9231f25e5d
commit e4f7d675a1
12 changed files with 71 additions and 215 deletions
@@ -13,6 +13,7 @@ return new class extends Migration
{
Schema::create('map_lahan', function (Blueprint $table) {
$table->id();
$table->string('uid')->unique();
$table->string('nama');
$table->string('status_kepemilikan');
@@ -21,8 +22,14 @@ return new class extends Migration
$table->foreignId('adat_pemilik_id')->nullable()->constrained('adat')->onDelete('set null');
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan');
$table->string('lat')->nullable();
$table->string('long')->nullable();
$table->jsonb('path')->nullable();
$table->boolean('sertifikat')->default(false);
$table->boolean('konflik')->default(false);
$table->text('deskripsi')->nullable();
$table->float('luas_lahan', 8)->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
@@ -33,11 +40,31 @@ return new class extends Migration
$table->softDeletes();
});
Schema::create('sertifikat_lahan', function (Blueprint $table) {
$table->id();
$table->string('uid')->unique();
$table->string('nomor_sertifikat');
$table->date('tanggal_terbit');
$table->date('tanggal_kadaluarsa')->nullable();
$table->string('lembaga_penerbit')->nullable();
$table->foreignId('lahan_id')->constrained('map_lahan')->onDelete('cascade');
$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('map_tanaman', function (Blueprint $table) {
$table->id();
$table->string('uid')->unique();
$table->string('nama');
$table->foreignId('komoditas_id')->constrained('master_komoditas')->onDelete('set null');
$table->foreignId('jenis_komoditas_id')->constrained('jenis_komoditas')->onDelete('set null');
$table->foreignId('varietas_id')->constrained('master_varietas')->onDelete('set null');
$table->foreignId('profile_id')->constrained('profiles')->onDelete('set null');
$table->foreignId('lahan_id')->constrained('map_lahan')->onDelete('set null');
@@ -46,6 +73,8 @@ return new class extends Migration
$table->float('longitude')->nullable();
$table->string('kondisi_tanaman')->nullable();
$table->string('metode_pengumpulan')->nullable();
$table->text('deskripsi')->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
@@ -62,6 +91,7 @@ return new class extends Migration
public function down(): void
{
Schema::dropIfExists('map_tanaman');
Schema::dropIfExists('sertifikat_lahan');
Schema::dropIfExists('map_lahan');
}
};