98 lines
3.9 KiB
PHP
98 lines
3.9 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('map_lahan', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('uid')->unique();
|
|
$table->string('nama');
|
|
$table->string('status_kepemilikan');
|
|
|
|
$table->foreignId('profile_id')->constrained('profiles');
|
|
$table->foreignId('keluarga_pengelola_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->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');
|
|
$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('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');
|
|
|
|
$table->float('latitude')->nullable();
|
|
$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');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('map_tanaman');
|
|
Schema::dropIfExists('sertifikat_lahan');
|
|
Schema::dropIfExists('map_lahan');
|
|
}
|
|
};
|