physiotherapy-clinic/database/migrations/2024_01_01_000004_create_appointments_table.php

32 lines
1.1 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('appointments', function (Blueprint $table) {
$table->id();
$table->foreignId('patient_id')->constrained('patients');
$table->foreignId('user_id')->constrained('users'); // therapist/doctor
$table->dateTime('appointment_date');
$table->integer('duration_minutes')->default(60);
$table->enum('status', ['scheduled', 'confirmed', 'in_progress', 'completed', 'cancelled', 'no_show'])->default('scheduled');
$table->text('notes')->nullable();
$table->text('cancellation_reason')->nullable();
$table->foreignId('cancelled_by')->nullable()->constrained('users');
$table->timestamp('cancelled_at')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
public function down(): void
{
Schema::dropIfExists('appointments');
}
};