Files
database-pertani-web/database/migrations/2026_06_05_000002_create_kualitas_table.php
T

40 lines
1.8 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('kualitas', function (Blueprint $table) {
$table->id();
$table->foreignId('produksi_id')->nullable()->constrained('produksi')->onDelete('set null');
$table->foreignId('profile_id')->nullable()->constrained('profiles')->onDelete('set null');
$table->foreignId('lahan_id')->nullable()->constrained('map_lahan')->onDelete('set null');
$table->foreignId('komoditas_id')->nullable()->constrained('master_komoditas')->onDelete('set null');
$table->date('tanggal_pemeriksaan')->nullable();
$table->string('grade')->nullable();
$table->decimal('kadar_air', 8, 2)->nullable();
$table->decimal('berat_bersih', 12, 2)->nullable();
$table->decimal('berat_rusak', 12, 2)->nullable();
$table->decimal('persentase_kerusakan', 8, 2)->nullable();
$table->string('standar_mutu')->nullable();
$table->string('status_kelayakan')->default('layak');
$table->string('pemeriksa')->nullable();
$table->text('catatan')->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();
});
}
public function down(): void
{
Schema::dropIfExists('kualitas');
}
};