Files
database-pertani-web/database/migrations/2026_04_27_092222_create_petani_table.php
T

64 lines
2.3 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('ekosistem_petani_cpm', function (Blueprint $table) {
$table->id();
$table->string('uid')->unique();
$table->foreignId('program_id')->nullable()->constrained('core_program')->nullOnDelete();
$table->string('nama');
$table->boolean('jenis_kelamin');
$table->string('tempat_lahir')->nullable();
$table->date('tanggal_lahir');
$table->string('pendidikan_terakhir')->nullable();
$table->string('alamat')->nullable();
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan');
$table->string('pekerjaan_utama')->nullable();
$table->foreignId('komoditas_id')->nullable()->constrained('master_komoditas');
$table->float('lama_bertani', 8)->nullable();
$table->float('luas_lahan', 8)->nullable();
$table->string('dusun_rt_rw')->nullable();
$table->string('nomor_telepon')->nullable();
$table->string('foto')->nullable();
$table->string('pekerjaan_sampingan')->nullable();
$table->foreignId('komoditas_sampingan_id')->nullable()->constrained('master_komoditas');
$table->float('lama_bertani_sampingan', 8)->nullable();
$table->float('luas_lahan_sampingan', 8)->nullable();
$table->string('status_perkawinan')->nullable();
$table->string('status_keluarga')->nullable();
$table->integer('jumlah_tanggungan')->nullable();
$table->jsonb('petani_pengumpul')->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();
});
}
public function down(): void
{
Schema::dropIfExists('ekosistem_petani_cpm');
}
};