MIF_E31220412/database/migrations/2024_03_22_create_sewa_tabl...

35 lines
1.0 KiB
PHP

<?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('sewa', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
$table->foreignId('paket_id')->constrained('paket')->onDelete('cascade');
$table->date('tanggal_mulai');
$table->date('tanggal_selesai');
$table->decimal('total_harga', 12, 2);
$table->decimal('biaya_operasional', 12, 2)->default(0);
$table->enum('status', ['pending', 'active', 'completed', 'cancelled'])->default('pending');
$table->text('catatan')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sewa');
}
};