fabrica

hanna/fabrica

873 bytes
Raw
1-- Groups gain their own settings: a manual flag (manual groups persist; auto
2-- groups are garbage-collected when empty), a visibility, and collaborators
3-- whose access cascades to every repository in the group's subtree.
4ALTER TABLE groups ADD COLUMN manual BOOLEAN NOT NULL DEFAULT FALSE;
5-- Auto/intermediate groups default to 'public' so they impose no visibility
6-- ceiling; only a deliberately-restricted group locks the repos beneath it.
7ALTER TABLE groups ADD COLUMN visibility TEXT NOT NULL DEFAULT 'public';
8
9CREATE TABLE group_collaborators (
10 id TEXT PRIMARY KEY,
11 group_id TEXT NOT NULL REFERENCES groups(id) ON DELETE CASCADE,
12 user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
13 permission TEXT NOT NULL,
14 created_at BIGINT NOT NULL
15);
16CREATE UNIQUE INDEX idx_group_collab ON group_collaborators (group_id, user_id);