Preserve readable private tables, discussion and pending games while closure blocks new play, joins, messages, AI and seat mutations. Add live-authorized atomic closure audits, room-version/revision fences, dedicated controls and exact saved retries. Reopen with the saved pause/join settings and current credentials; restoring a removed but closed room keeps its AI stopped. Verified types, lint, 5356 offline tests, 52 HTTP tests and build. Seventeen dedicated authenticated HTTP groups and independent privacy/persistence review passed. Desktop/mobile browser QA confirmed one close after a lost response and refresh, persistent readable notices, retained private draft, mobile reopening and saved-seat refresh. All 2,001 baseline rooms, 4,243 seats and related records preserved. Positive production admin acceptance awaits authorized QA access; full admin and rules gates remain open.
29 lines
1.2 KiB
SQL
29 lines
1.2 KiB
SQL
CREATE TABLE `admin_room_closures` (
|
|
`operation_id` text PRIMARY KEY NOT NULL,
|
|
`actor_admin_id` text NOT NULL,
|
|
`room_code` text NOT NULL,
|
|
`request_hash` text NOT NULL,
|
|
`expected_version` integer NOT NULL,
|
|
`expected_revision` integer NOT NULL,
|
|
`applied_version` integer NOT NULL,
|
|
`applied_revision` integer NOT NULL,
|
|
`closed` integer NOT NULL,
|
|
`reason` text NOT NULL,
|
|
`before_metadata` text NOT NULL,
|
|
`after_metadata` text NOT NULL,
|
|
`created_at` integer NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `admin_room_closures_room` ON `admin_room_closures` (`room_code`,`created_at`);--> statement-breakpoint
|
|
CREATE TABLE `room_closures` (
|
|
`room_code` text PRIMARY KEY NOT NULL,
|
|
`closed` integer DEFAULT 0 NOT NULL,
|
|
`revision` integer DEFAULT 0 NOT NULL,
|
|
`closed_at` integer,
|
|
`updated_at` integer NOT NULL,
|
|
FOREIGN KEY (`room_code`) REFERENCES `rooms`(`code`) ON UPDATE no action ON DELETE cascade,
|
|
CONSTRAINT "room_closures_closed" CHECK("room_closures"."closed" IN (0, 1)),
|
|
CONSTRAINT "room_closures_revision" CHECK("room_closures"."revision" >= 0),
|
|
CONSTRAINT "room_closures_time" CHECK(("room_closures"."closed" = 1 AND "room_closures"."closed_at" IS NOT NULL) OR ("room_closures"."closed" = 0 AND "room_closures"."closed_at" IS NULL))
|
|
);
|