33 lines
1.3 KiB
PHP
33 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('map_panen', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('uid')->unique()->nullable(); // Bagus untuk sinkronisasi Dexie offline
|
|
$table->string('title'); // Judul aktivitas panen
|
|
$table->unsignedBigInteger('lahan_id')->nullable();
|
|
$table->unsignedBigInteger('petani_id')->nullable();
|
|
$table->text('deskripsi')->nullable(); // Deskripsi kondisi lahan saat panen
|
|
$table->date('tgl_panen');
|
|
$table->text('catatan')->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->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
public function down(): void {
|
|
Schema::dropIfExists('map_panen');
|
|
}
|
|
}; |