Saltar al contenido principal

ObelioScheduling — Database Schema

:::info Auto-generated This page is generated automatically from the Table/*.xml files in obeliOmed/OftalmolAgenda on every merge to develop. Last updated: 2026-06-20. :::

Table overview

9 tables defined by this plugin.

TableColumnsConstraints
oft_appointment_resource_links43
oft_appointment_resource_types71
oft_appointment_resources81
oft_appointment_rooms41
oft_appointment_status31
oft_appointment_types51
oft_appointments154
oft_specialist_schedule82
oft_specialist_unavailability92

:::note Naming conventions

  • Constraints follow ADR-027 prefix pattern: pk_ primary key, fk_ foreign key, uq_ unique, idx_ index.
  • Table names follow ADR-025 rename: obelio_<plugin>_* (legacy oft_* tables migrated during v2 refactor).

:::

Table details

ColumnTypeNullDefault
idserialNO
idAppointmentintegerNO
idResourceintegerNO
creationDatetimestampYES

Foreign keys:

  • oft_appointment_resource_links_appointment_fk: FOREIGN KEY (idAppointment) REFERENCES oft_appointments (id) ON DELETE CASCADE ON UPDATE CASCADE
  • oft_appointment_resource_links_resource_fk: FOREIGN KEY (idResource) REFERENCES oft_appointment_resources (id) ON DELETE RESTRICT ON UPDATE CASCADE

Unique constraints:

  • oft_appointment_resource_links_unique: UNIQUE (idAppointment, idResource)

oft_appointment_resource_types

ColumnTypeNullDefault
codevarchar(40)NO
namevarchar(120)NO
descriptiontextYES
iconvarchar(80)YES
sort_orderintegerYES0
creationDatetimestampYES
modificationDatetimestampYES

Primary key: PRIMARY KEY (code)

oft_appointment_resources

ColumnTypeNullDefault
idserialNO
idTypeCodevarchar(40)NO
idOriginintegerYES
namevarchar(160)NO
codevarchar(40)YES
activebooleanYEStrue
creationDatetimestampYES
modificationDatetimestampYES

Foreign keys:

  • oft_appointment_resources_type_fk: FOREIGN KEY (idTypeCode) REFERENCES oft_appointment_resource_types (code) ON DELETE RESTRICT ON UPDATE CASCADE

oft_appointment_rooms

ColumnTypeNullDefault
idserialNO
idSpecialityintYES
namevarchar(250)NO
descriptionvarchar(250)NO

Primary key: PRIMARY KEY (id)

oft_appointment_status

ColumnTypeNullDefault
idserialNO
namevarchar(250)NO
colorvarchar(20)NO

Primary key: PRIMARY KEY (id)

oft_appointment_types

ColumnTypeNullDefault
idserialNO
idSpecialityintYES
idReasonintYES
namevarchar(250)NO
durationintYES30

Primary key: PRIMARY KEY (id)

oft_appointments

ColumnTypeNullDefault
idserialNO
idPatientintNO
idSpecialityintNO
idSpecialistintNO
idRoomintYES
idLinkedRecordintYES
linkedRecordTypevarchar(40)YES
appointmentDatedatetimeNO
durationintYES30
statusvarchar(20)YES'pending'
typeintYES
notestextYES
nickvarchar(50)NO
creationDatedatetimeNOCURRENT_TIMESTAMP
modificationDatedatetimeNOCURRENT_TIMESTAMP

Primary key: PRIMARY KEY (id)

Foreign keys:

  • fk_oft_appointments_patient: FOREIGN KEY (idPatient) REFERENCES oft_patients (idPatient) ON DELETE CASCADE ON UPDATE CASCADE
  • fk_oft_appointments_specialist: FOREIGN KEY (idSpecialist) REFERENCES oft_specialists (id) ON DELETE CASCADE ON UPDATE CASCADE
  • fk_oft_appointments_clinic: FOREIGN KEY (idClinic) REFERENCES oft_clinics (id) ON DELETE SET NULL ON UPDATE CASCADE

oft_specialist_schedule

ColumnTypeNullDefault
idserialNO
idSpecialistintNO
dayOfWeeksmallintNO
startTimetimeNO
endTimetimeNO
slotDurationintYES30
isActivebooleanYEStrue
creationDatedatetimeNOCURRENT_TIMESTAMP

Primary key: PRIMARY KEY (id)

Foreign keys:

  • fk_oft_specialist_schedule_specialist: FOREIGN KEY (idSpecialist) REFERENCES oft_specialists (id) ON DELETE CASCADE ON UPDATE CASCADE

oft_specialist_unavailability

ColumnTypeNullDefault
idserialNO
idSpecialistintNO
startDatedateNO
endDatedateNO
startTimetimeYES
endTimetimeYES
typevarchar(30)YES
notestextYES
creationDatedatetimeNOCURRENT_TIMESTAMP

Primary key: PRIMARY KEY (id)

Foreign keys:

  • fk_oft_specialist_unavailability_specialist: FOREIGN KEY (idSpecialist) REFERENCES oft_specialists (id) ON DELETE CASCADE ON UPDATE CASCADE