Files
Dune/drizzle/0014_admin_room_archive.sql
Quintine e918e2e0c0 Add reversible administrator room archiving
Organize closed rooms with archive filters, live-authorized atomic receipts and exact saved retries. Preserve saved games, timestamps, credentials, discussion and AI deadlines. Unarchive leaves play closed; reopen requires unarchive, and removal/restoration preserves both flags.

Verified types, lint, 5379 offline tests, 52 HTTP tests and build. Twenty dedicated administrator HTTP groups and independent privacy/persistence review passed. Desktop/mobile browser QA confirmed a single archive after a lost response and refresh, readable recovery text, mobile unarchive and separate reopening, and saved-seat restoration. All 2,049 baseline rooms, 4,348 seats and related records preserved. Authenticated production admin acceptance awaits authorized QA access; full admin and rules gates remain open.
2026-09-22 12:55:44 +10:00

29 lines
1.3 KiB
SQL

CREATE TABLE `admin_room_archives` (
`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,
`archived` 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_archives_room` ON `admin_room_archives` (`room_code`,`created_at`);--> statement-breakpoint
CREATE TABLE `room_archives` (
`room_code` text PRIMARY KEY NOT NULL,
`archived` integer DEFAULT 0 NOT NULL,
`revision` integer DEFAULT 0 NOT NULL,
`archived_at` integer,
`updated_at` integer NOT NULL,
FOREIGN KEY (`room_code`) REFERENCES `rooms`(`code`) ON UPDATE no action ON DELETE cascade,
CONSTRAINT "room_archives_archived" CHECK("room_archives"."archived" IN (0, 1)),
CONSTRAINT "room_archives_revision" CHECK("room_archives"."revision" >= 0),
CONSTRAINT "room_archives_time" CHECK(("room_archives"."archived" = 1 AND "room_archives"."archived_at" IS NOT NULL) OR ("room_archives"."archived" = 0 AND "room_archives"."archived_at" IS NULL))
);