feat: add session capacity waitlist
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
-- Add per-session seat limits and participant waitlist support.
|
||||
ALTER TABLE sessions
|
||||
ADD COLUMN max_players INTEGER,
|
||||
ADD CONSTRAINT ck_sessions_max_players CHECK (max_players IS NULL OR max_players > 0);
|
||||
|
||||
ALTER TABLE session_participants
|
||||
ADD COLUMN registration_status VARCHAR(50) NOT NULL DEFAULT 'Active'
|
||||
CHECK (registration_status IN ('Active', 'Waitlisted')),
|
||||
ADD COLUMN created_at TIMESTAMPTZ NOT NULL DEFAULT now();
|
||||
|
||||
CREATE INDEX ix_session_participants_session_registration_status
|
||||
ON session_participants (session_id, registration_status);
|
||||
|
||||
CREATE INDEX ix_session_participants_waitlist_order
|
||||
ON session_participants (session_id, created_at, id)
|
||||
WHERE registration_status = 'Waitlisted';
|
||||
Reference in New Issue
Block a user