Files
CKB/database/migrations/2025_07_10_140352_create_prechecks_table.php

60 lines
2.3 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePrechecksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('prechecks', function (Blueprint $table) {
$table->id();
$table->foreignId('transaction_id')->constrained()->onDelete('cascade');
$table->foreignId('precheck_by')->constrained('users')->onDelete('cascade');
$table->timestamp('precheck_at')->nullable();
$table->string('police_number');
$table->string('spk_number');
$table->string('front_image', 255)->nullable();
$table->json('front_image_metadata')->nullable();
$table->decimal('kilometer', 10, 2);
$table->decimal('pressure_high', 10, 2);
$table->decimal('pressure_low', 10, 2)->nullable();
$table->decimal('cabin_temperature', 10, 2)->nullable();
$table->string('cabin_temperature_image', 255)->nullable();
$table->json('cabin_temperature_image_metadata')->nullable();
$table->enum('ac_condition', ['kotor', 'rusak', 'baik', 'tidak ada'])->nullable();
$table->string('ac_image', 255)->nullable();
$table->json('ac_image_metadata')->nullable();
$table->enum('blower_condition', ['kotor', 'rusak', 'baik', 'tidak ada'])->nullable();
$table->string('blower_image', 255)->nullable();
$table->json('blower_image_metadata')->nullable();
$table->enum('evaporator_condition', ['kotor', 'berlendir', 'bocor', 'bersih'])->nullable();
$table->string('evaporator_image', 255)->nullable();
$table->json('evaporator_image_metadata')->nullable();
$table->enum('compressor_condition', ['kotor', 'rusak', 'baik', 'tidak ada'])->nullable();
$table->text('precheck_notes')->nullable();
$table->timestamps();
$table->index(['transaction_id']);
$table->index(['precheck_by']);
$table->index(['precheck_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('prechecks');
}
}