vuln-hospital-booking

Tables (9)

appointment_status_history

  • id — BIGINT — Primary key — NOT NULL
  • appointment_id — BIGINT — Foreign key → appointments.id — NOT NULL
  • changed_by_user_id — BIGINT — Foreign key → users.id
  • from_status — VARCHAR(30)
  • to_status — VARCHAR(30) — NOT NULL
  • reason — VARCHAR(500)
  • created_at — TIMESTAMP — NOT NULL

appointments

  • id — BIGINT — Primary key — NOT NULL
  • public_id — VARCHAR(36) — NOT NULL
  • patient_user_id — BIGINT — Foreign key → users.id — NOT NULL
  • availability_slot_id — BIGINT — Foreign key → doctor_availability_slots.id — NOT NULL
  • reason — VARCHAR(255) — NOT NULL
  • notes — TEXT — NOT NULL
  • status — VARCHAR(30) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

departments

  • id — BIGINT — Primary key — NOT NULL
  • name — VARCHAR(120) — NOT NULL
  • description — TEXT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

doctor_availability_slots

  • id — BIGINT — Primary key — NOT NULL
  • public_id — VARCHAR(36) — NOT NULL
  • doctor_id — BIGINT — Foreign key → doctors.id — NOT NULL
  • starts_at — TIMESTAMP — NOT NULL
  • ends_at — TIMESTAMP — NOT NULL
  • is_available — BOOLEAN — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

doctors

  • id — BIGINT — Primary key — NOT NULL
  • public_id — VARCHAR(36) — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • department_id — BIGINT — Foreign key → departments.id — NOT NULL
  • name — VARCHAR(120) — NOT NULL
  • specialty — VARCHAR(160) — NOT NULL
  • bio — TEXT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

generated_pdfs

  • id — BIGINT — Primary key — NOT NULL
  • public_id — VARCHAR(36) — NOT NULL
  • generated_by_user_id — BIGINT — Foreign key → users.id — NOT NULL
  • appointment_id — BIGINT — Foreign key → appointments.id
  • medical_document_id — BIGINT — Foreign key → medical_documents.id
  • filename — VARCHAR(255) — NOT NULL
  • storage_path — VARCHAR(500) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

medical_documents

  • id — BIGINT — Primary key — NOT NULL
  • public_id — VARCHAR(36) — NOT NULL
  • owner_patient_user_id — BIGINT — Foreign key → users.id — NOT NULL
  • author_doctor_id — BIGINT — Foreign key → doctors.id
  • title — VARCHAR(180) — NOT NULL
  • document_type — VARCHAR(80) — NOT NULL
  • classification — VARCHAR(30) — NOT NULL
  • file_path — VARCHAR(500) — NOT NULL
  • file_size — BIGINT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

user_sessions

  • id — BIGINT — Primary key — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • session_token_hash — VARCHAR(255) — NOT NULL
  • role_snapshot — VARCHAR(30) — NOT NULL
  • source_ip — VARCHAR(64)
  • user_agent_hash — VARCHAR(255)
  • created_at — TIMESTAMP — NOT NULL
  • expires_at — TIMESTAMP — NOT NULL
  • revoked_at — TIMESTAMP

users

  • id — BIGINT — Primary key — NOT NULL
  • public_id — VARCHAR(36) — NOT NULL
  • username — VARCHAR(80) — NOT NULL
  • password_hash — VARCHAR(255) — NOT NULL
  • role — VARCHAR(30) — NOT NULL
  • full_name — VARCHAR(120) — NOT NULL
  • email — VARCHAR(255) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL