35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration {
|
|
public function up(): void {
|
|
Schema::create('lahan_inspeksi', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('petani_id')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->unsignedBigInteger('lahan_id')->nullable();
|
|
$table->string('lahan_uid');
|
|
$table->double('kadar_air')->nullable();
|
|
$table->double('ph')->nullable();
|
|
$table->double('kelembapan')->nullable();
|
|
$table->double('temperatur')->nullable();
|
|
$table->string('kondisi_tanaman')->nullable();
|
|
$table->date('tgl_inspeksi');
|
|
$table->text('catatan')->nullable();
|
|
$table->string('foto_url')->nullable();
|
|
$table->string('sync_status')->default('pending');
|
|
|
|
// Audit Columns
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
|
|
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void {
|
|
Schema::dropIfExists('lahan_inspeksi');
|
|
}
|
|
}; |