non-booking-time-blockers (nbtb)

This commit is contained in:
2026-03-04 11:38:34 +00:00
parent 861dd11c5b
commit 29b9776a93
12 changed files with 845 additions and 139 deletions
+20
View File
@@ -313,6 +313,26 @@ CREATE TABLE exceptional_group_applications (
CREATE UNIQUE INDEX idx_group_application_week ON exceptional_group_applications(week_start);
-- =======================================
-- TIME BLOCKERS TABLE
-- =======================================
-- Admin-defined time periods that are unavailable for booking
-- Used for doctor appointments, extended lunch, training, etc.
CREATE TABLE time_blockers (
id CHAR(12) PRIMARY KEY DEFAULT generate_short_id('time_blockers'),
start_time TIMESTAMPTZ NOT NULL,
duration_minutes INT NOT NULL CHECK (duration_minutes > 0),
description TEXT,
cron_expression TEXT, -- NULL = one-off, otherwise cron pattern for recurring
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
created_by CHAR(12) REFERENCES users(id) ON DELETE SET NULL
);
-- Indexes for efficient overlap queries
CREATE INDEX idx_time_blockers_start_time ON time_blockers(start_time);
CREATE INDEX idx_time_blockers_cron ON time_blockers(cron_expression) WHERE cron_expression IS NOT NULL;
-- =======================================
-- PAYMENTS TABLE