All checks were successful
CI/CD / detect-changes (pull_request) Successful in 3s
CI/CD / test-frontend (pull_request) Successful in 5s
CI/CD / test-go-pg (pull_request) Successful in 2m40s
CI/CD / test-sqlite (pull_request) Successful in 2m45s
CI/CD / build-and-deploy (pull_request) Successful in 25s
- CSS headers (4 files): Switchboard Core → Armature - Editor .mjs headers (8 files): Chat Switchboard → Armature - SQL migration comments + seed data (20 files): Switchboard Core → Armature - Webhook header: X-Switchboard-Event → X-Armature-Event - Cookie: sb_token → arm_token (3 Go files + auth.js) - localStorage: sb_auth → arm_auth (auth.js + 2 test runners) - localStorage: switchboard_theme → armature_theme (theme.js + base.html) - Debug engine filter: chatSwitchboard/switchboard/sb_ → armatureChat/armature/arm_ - JS export: switchboardTheme → armatureTheme (theme.mjs + code-editor.mjs) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
60 lines
2.6 KiB
SQL
60 lines
2.6 KiB
SQL
-- ==========================================
|
|
-- Armature — 004 Connections & Dependencies (SQLite)
|
|
-- ==========================================
|
|
|
|
CREATE TABLE IF NOT EXISTS ext_connections (
|
|
id TEXT PRIMARY KEY,
|
|
type TEXT NOT NULL,
|
|
package_id TEXT NOT NULL,
|
|
scope TEXT NOT NULL CHECK (scope IN ('global', 'team', 'personal')),
|
|
owner_id TEXT NOT NULL DEFAULT '',
|
|
name TEXT NOT NULL,
|
|
config TEXT NOT NULL DEFAULT '{}',
|
|
is_active INTEGER DEFAULT 1,
|
|
created_at TEXT DEFAULT (datetime('now')),
|
|
updated_at TEXT DEFAULT (datetime('now')),
|
|
UNIQUE(type, scope, owner_id, name)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_ext_connections_type ON ext_connections(type);
|
|
CREATE INDEX IF NOT EXISTS idx_ext_connections_scope ON ext_connections(scope);
|
|
CREATE INDEX IF NOT EXISTS idx_ext_connections_owner ON ext_connections(owner_id);
|
|
CREATE INDEX IF NOT EXISTS idx_ext_connections_active ON ext_connections(is_active);
|
|
|
|
CREATE TRIGGER IF NOT EXISTS ext_connections_updated_at AFTER UPDATE ON ext_connections
|
|
FOR EACH ROW WHEN NEW.updated_at = OLD.updated_at
|
|
BEGIN UPDATE ext_connections SET updated_at = datetime('now') WHERE id = NEW.id; END;
|
|
|
|
CREATE TABLE IF NOT EXISTS ext_dependencies (
|
|
consumer_id TEXT NOT NULL,
|
|
library_id TEXT NOT NULL,
|
|
version_spec TEXT NOT NULL DEFAULT '>=0.0.0',
|
|
resolved_ver TEXT NOT NULL DEFAULT '0.0.0',
|
|
PRIMARY KEY (consumer_id, library_id),
|
|
FOREIGN KEY (consumer_id) REFERENCES packages(id) ON DELETE CASCADE,
|
|
FOREIGN KEY (library_id) REFERENCES packages(id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_ext_deps_consumer ON ext_dependencies(consumer_id);
|
|
CREATE INDEX IF NOT EXISTS idx_ext_deps_library ON ext_dependencies(library_id);
|
|
|
|
CREATE TABLE IF NOT EXISTS resource_grants (
|
|
id TEXT PRIMARY KEY,
|
|
resource_type TEXT NOT NULL,
|
|
resource_id TEXT NOT NULL,
|
|
grant_scope TEXT NOT NULL DEFAULT 'team_only'
|
|
CHECK (grant_scope IN ('team_only', 'global', 'groups')),
|
|
granted_groups TEXT NOT NULL DEFAULT '[]',
|
|
created_by TEXT NOT NULL REFERENCES users(id),
|
|
created_at TEXT DEFAULT (datetime('now')),
|
|
updated_at TEXT DEFAULT (datetime('now')),
|
|
UNIQUE(resource_type, resource_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_resource_grants_resource
|
|
ON resource_grants(resource_type, resource_id);
|
|
|
|
CREATE TRIGGER IF NOT EXISTS resource_grants_updated_at AFTER UPDATE ON resource_grants
|
|
FOR EACH ROW WHEN NEW.updated_at = OLD.updated_at
|
|
BEGIN UPDATE resource_grants SET updated_at = datetime('now') WHERE id = NEW.id; END;
|