Support multiple room sizes via room_groups table

This commit is contained in:
Ian Gulliver
2026-02-16 13:49:15 -08:00
parent 037bef6bc8
commit 1f16aa1ff8
7 changed files with 218 additions and 61 deletions

View File

@@ -11,11 +11,19 @@ END $$;
CREATE TABLE IF NOT EXISTS trips (
id BIGSERIAL PRIMARY KEY,
name TEXT NOT NULL,
room_size INTEGER NOT NULL DEFAULT 2,
prefer_not_multiple INTEGER NOT NULL DEFAULT 5,
no_prefer_cost INTEGER NOT NULL DEFAULT 10
);
CREATE TABLE IF NOT EXISTS room_groups (
id BIGSERIAL PRIMARY KEY,
trip_id BIGINT NOT NULL REFERENCES trips(id) ON DELETE CASCADE,
size INTEGER NOT NULL,
count INTEGER NOT NULL,
CHECK(size >= 1),
CHECK(count >= 1)
);
CREATE TABLE IF NOT EXISTS trip_admins (
id BIGSERIAL PRIMARY KEY,
trip_id BIGINT NOT NULL REFERENCES trips(id) ON DELETE CASCADE,