CREATE TABLE IF NOT EXISTS `schedules` (
    `id`           INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `therapist_id` INT UNSIGNED NOT NULL,
    `day_of_week`  TINYINT UNSIGNED NOT NULL COMMENT '0=Sun, 1=Mon ... 6=Sat',
    `start_time`   TIME NOT NULL,
    `end_time`     TIME NOT NULL,
    `is_available` TINYINT(1) NOT NULL DEFAULT 1,
    `created_at`   DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`   DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `schedules_therapist_day_unique` (`therapist_id`, `day_of_week`),
    CONSTRAINT `fk_sch_therapist` FOREIGN KEY (`therapist_id`) REFERENCES `therapist_profiles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
