carrentalservice/database/migrations/2026_02_19_091540_create_services_table.php
2026-02-19 22:05:20 +00:00

30 lines
1005 B
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('services', function (Blueprint $table) {
$table->id();
$table->foreignId('car_id')->constrained()->onDelete('cascade');
$table->enum('type', ['oil_change', 'tire_rotation', 'brake_service', 'general_checkup', 'repair', 'insurance', 'other']);
$table->text('description');
$table->decimal('cost', 10, 2);
$table->date('service_date');
$table->date('next_service_date')->nullable();
$table->integer('mileage_at_service')->nullable();
$table->enum('status', ['scheduled', 'in_progress', 'completed'])->default('completed');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('services');
}
};