Model and Migration files
This commit is contained in:
@@ -10,11 +10,11 @@ return new class extends Migration {
|
||||
$table->id();
|
||||
$table->string('uid')->unique()->nullable(); // Bagus untuk sinkronisasi Dexie offline
|
||||
$table->string('title'); // Judul aktivitas panen
|
||||
$table->unsignedBigInteger('land_id')->nullable();
|
||||
$table->unsignedBigInteger('farmer_id')->nullable();
|
||||
$table->text('land_description')->nullable(); // Deskripsi kondisi lahan saat panen
|
||||
$table->date('harvest_date');
|
||||
$table->text('notes')->nullable();
|
||||
$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
|
||||
|
||||
@@ -11,13 +11,14 @@ return new class extends Migration {
|
||||
$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('tanaman_uid');
|
||||
$table->date('tgl_inspeksi')->nullable();
|
||||
$table->string('status_tanaman')->nullable();
|
||||
$table->string('produktifitas')->nullable();
|
||||
$table->string('masalah')->nullable();
|
||||
$table->text('deskripsi')->nullable();
|
||||
$table->text('tindakan')->nullable();
|
||||
$table->text('catatan')->nullable();
|
||||
$table->string('sync_status')->default('pending');
|
||||
|
||||
// Audit Columns
|
||||
|
||||
@@ -6,15 +6,17 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
Schema::create('inspeksi_lahan', function (Blueprint $table) {
|
||||
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');
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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::table('master_komoditas', function (Blueprint $table) {
|
||||
$table->string('kode')->unique();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('master_komoditas', function (Blueprint $table) {
|
||||
$table->dropUnique('kode');
|
||||
$table->dropColumn('kode');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('panen_komoditas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uid')->unique()->nullable();
|
||||
$table->foreignId('panen_id')->constrained('map_panen')->onDelete('cascade');
|
||||
|
||||
$table->unsignedBigInteger('plant_id')->nullable(); // ID Tanaman (tanaman_id)
|
||||
$table->integer('komoditas_id'); // Nama komoditas
|
||||
$table->double('weight_kg')->default(0); // Berat hasil panen (panen_kg)
|
||||
$table->string('sync_status')->default('pending');
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('panen_komoditas');
|
||||
}
|
||||
};
|
||||
@@ -19,9 +19,9 @@ return new class extends Migration
|
||||
->onDelete('cascade');
|
||||
|
||||
$bluePrint->unsignedBigInteger('tanaman_id')->nullable();
|
||||
$bluePrint->string('commodity_name');
|
||||
$bluePrint->string('komoditas_id');
|
||||
$bluePrint->string('sync_status', 50)->nullable()->default('synced');
|
||||
$bluePrint->decimal('weight_kg', 10, 2); // Menggunakan decimal agar mendukung angka pecahan (misal: 10.5 kg)
|
||||
$bluePrint->decimal('berat_kg', 10, 2); // Menggunakan decimal agar mendukung angka pecahan (misal: 10.5 kg)
|
||||
|
||||
$bluePrint->timestamps();
|
||||
$bluePrint->softDeletes(); // Menambahkan kolom deleted_at untuk fitur SoftDeletes
|
||||
|
||||
Reference in New Issue
Block a user