Files
database-pertani-web/database/migrations/2026_04_27_092222_create_petani_table.php
T
2026-04-28 15:02:53 +07:00

59 lines
2.0 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('nama');
$table->boolean('jenis_kelamin');
$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('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();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ekosistem_petani_cpm');
}
};