37 lines
1.5 KiB
PHP
37 lines
1.5 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('tanaman_inspeksi', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('tanaman_id')->nullable();
|
|
$table->unsignedBigInteger('lahan_id')->nullable();
|
|
$table->unsignedBigInteger('petani_id')->nullable();
|
|
$table->date('inspection_date')->nullable();
|
|
$table->string('health_status')->nullable();
|
|
$table->string('productivity_status')->nullable();
|
|
$table->string('issue_type')->nullable();
|
|
$table->text('issue_description')->nullable();
|
|
$table->text('recommendation')->nullable();
|
|
$table->text('notes')->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->timestamp('created_date')->useCurrent();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
public function down(): void {
|
|
Schema::dropIfExists('tanaman_inspeksi');
|
|
}
|
|
}; |