Skip to content

g1t/services/identity/migrations/0029_workspace_aliases.sql

21 lines1,130 bytesCodeBlame
1-- Workspace aliases: a name g1t's staff point at a workspace, so its
2-- addresses lead there under the workspace's own name. Staff-managed only,
3-- from sudo; not a feature workspaces can use. An alias is a reserved or
4-- unclaimed name, never a person's or a workspace's, and points at the
5-- workspace's id, so it follows the workspace through renames. See
6-- src/aliases.rs.
7CREATE TABLE workspace_aliases (
8 alias TEXT PRIMARY KEY,
9 workspace_id TEXT NOT NULL REFERENCES workspaces (id) ON DELETE CASCADE,
10 created_by TEXT NOT NULL,
11 created_at TEXT NOT NULL,
12 note TEXT NOT NULL DEFAULT ''
13);
14CREATE INDEX workspace_aliases_by_workspace ON workspace_aliases (workspace_id);
15
16-- g1t is the product Flagon, Inc. builds; flagon-io is the organization.
17-- Nothing is added where flagon-io does not exist (a fresh self-hosted
18-- install, a local database).
19INSERT OR IGNORE INTO workspace_aliases (alias, workspace_id, created_by, created_at, note)
20SELECT 'g1t', id, 'migration', strftime('%Y-%m-%dT%H:%M:%fZ', 'now'), 'The product''s name, for Flagon, Inc.'
21FROM workspaces WHERE slug = 'flagon-io' AND deleted_at IS NULL;