group editor implemented
This commit is contained in:
@@ -65,3 +65,28 @@ CREATE INDEX IF NOT EXISTS idx_routes_status ON routes(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_routes_activation ON routes(status, activated_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_pois_route ON pois(route_id, sequence);
|
||||
CREATE INDEX IF NOT EXISTS idx_poi_images_poi ON poi_images(poi_id, sequence);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS collaboration_sessions (
|
||||
token_hash TEXT PRIMARY KEY NOT NULL,
|
||||
creator_id TEXT NOT NULL,
|
||||
expires_at INTEGER NOT NULL
|
||||
) STRICT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS collaboration_groups (
|
||||
id TEXT PRIMARY KEY NOT NULL,
|
||||
route_id INTEGER NOT NULL UNIQUE REFERENCES routes(id),
|
||||
source_route_id INTEGER REFERENCES routes(id),
|
||||
owner_creator_id TEXT NOT NULL,
|
||||
code_hash TEXT UNIQUE,
|
||||
code_expires_at INTEGER NOT NULL,
|
||||
active INTEGER NOT NULL DEFAULT 1 CHECK (active IN (0, 1)),
|
||||
revision INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
) STRICT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS collaboration_members (
|
||||
group_id TEXT NOT NULL REFERENCES collaboration_groups(id) ON DELETE CASCADE,
|
||||
session_hash TEXT NOT NULL REFERENCES collaboration_sessions(token_hash) ON DELETE CASCADE,
|
||||
role TEXT NOT NULL CHECK (role IN ('owner', 'member')),
|
||||
PRIMARY KEY (group_id, session_hash)
|
||||
) STRICT;
|
||||
|
||||
Reference in New Issue
Block a user