This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
BEGIN;
|
||||
SET ROLE identity_role;
|
||||
CREATE TABLE IF NOT EXISTS identity.actors (actor_id TEXT PRIMARY KEY, display_name TEXT NOT NULL, recorded_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP);
|
||||
CREATE TABLE IF NOT EXISTS identity.principals (principal_id TEXT PRIMARY KEY, display_name TEXT NOT NULL, recorded_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP);
|
||||
CREATE TABLE IF NOT EXISTS identity.principal_bindings (actor_id TEXT NOT NULL, principal_id TEXT NOT NULL, active BOOLEAN NOT NULL, recorded_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (actor_id, principal_id));
|
||||
INSERT INTO identity.actors (actor_id, display_name) VALUES ('domovoy-creator-actor', 'Domovoy Creator') ON CONFLICT (actor_id) DO NOTHING;
|
||||
INSERT INTO identity.principals (principal_id, display_name) VALUES ('domovoy-creator-principal', 'Domovoy Creator Principal') ON CONFLICT (principal_id) DO NOTHING;
|
||||
INSERT INTO identity.principal_bindings (actor_id, principal_id, active) VALUES ('domovoy-creator-actor', 'domovoy-creator-principal', TRUE) ON CONFLICT (actor_id, principal_id) DO NOTHING;
|
||||
RESET ROLE;
|
||||
SET ROLE authority_role;
|
||||
CREATE TABLE IF NOT EXISTS authority.scopes (scope_id TEXT PRIMARY KEY, label TEXT NOT NULL, global_scope BOOLEAN NOT NULL, recorded_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP);
|
||||
CREATE TABLE IF NOT EXISTS authority.authority_grants (grant_id TEXT PRIMARY KEY, actor_id TEXT NOT NULL, principal_id TEXT NOT NULL, scope_id TEXT NOT NULL, grant_class TEXT NOT NULL, revision BIGINT NOT NULL, active BOOLEAN NOT NULL, valid_from TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, valid_until TIMESTAMPTZ, CHECK (revision > 0));
|
||||
INSERT INTO authority.scopes (scope_id, label, global_scope) VALUES ('domovoy-global-scope', 'All Domovoy scopes', TRUE) ON CONFLICT (scope_id) DO NOTHING;
|
||||
INSERT INTO authority.authority_grants (grant_id, actor_id, principal_id, scope_id, grant_class, revision, active) VALUES ('domovoy-creator-grant', 'domovoy-creator-actor', 'domovoy-creator-principal', 'domovoy-global-scope', 'CREATOR', 1, TRUE) ON CONFLICT (grant_id) DO NOTHING;
|
||||
RESET ROLE;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,16 @@
|
||||
BEGIN;
|
||||
SET ROLE continuity_role;
|
||||
CREATE TABLE IF NOT EXISTS continuity.prospective_items (
|
||||
prospective_item_id TEXT PRIMARY KEY,
|
||||
commitment_id TEXT NOT NULL,
|
||||
owner_principal_id TEXT NOT NULL,
|
||||
scope_id TEXT NOT NULL,
|
||||
goal_id TEXT NOT NULL,
|
||||
trigger_at_unix_millis BIGINT NOT NULL,
|
||||
state TEXT NOT NULL,
|
||||
revision BIGINT NOT NULL,
|
||||
recorded_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CHECK (revision > 0)
|
||||
);
|
||||
RESET ROLE;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,15 @@
|
||||
BEGIN;
|
||||
SET ROLE situation_role;
|
||||
CREATE TABLE IF NOT EXISTS situation.focus_bindings (
|
||||
focus_binding_id TEXT PRIMARY KEY,
|
||||
actor_id TEXT NOT NULL,
|
||||
session_id TEXT NOT NULL,
|
||||
workspace_id TEXT NOT NULL,
|
||||
project_id TEXT NOT NULL,
|
||||
goal_id TEXT NOT NULL,
|
||||
scope_id TEXT NOT NULL,
|
||||
active BOOLEAN NOT NULL,
|
||||
recorded_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
RESET ROLE;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
SET ROLE work_role;
|
||||
CREATE TABLE IF NOT EXISTS work.tasks (task_id TEXT PRIMARY KEY, goal_id TEXT NOT NULL, scope_id TEXT NOT NULL, revision BIGINT NOT NULL, CHECK (revision > 0));
|
||||
RESET ROLE;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
SET ROLE commit_role;
|
||||
CREATE TABLE IF NOT EXISTS commit.authorized_actions (authorized_action_id TEXT PRIMARY KEY, action_intent_id TEXT NOT NULL, state TEXT NOT NULL, revision BIGINT NOT NULL, CHECK (revision > 0));
|
||||
CREATE TABLE IF NOT EXISTS commit.action_attempts (action_attempt_id TEXT PRIMARY KEY, authorized_action_id TEXT NOT NULL, action_intent_id TEXT NOT NULL, state TEXT NOT NULL, recorded_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP);
|
||||
RESET ROLE;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,12 @@
|
||||
BEGIN;
|
||||
SET ROLE capability_role;
|
||||
CREATE TABLE IF NOT EXISTS capability.health (
|
||||
capability_id TEXT PRIMARY KEY,
|
||||
state TEXT NOT NULL,
|
||||
reason TEXT NOT NULL,
|
||||
revision BIGINT NOT NULL,
|
||||
recorded_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CHECK (revision > 0)
|
||||
);
|
||||
RESET ROLE;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,18 @@
|
||||
BEGIN;
|
||||
SET ROLE capability_role;
|
||||
ALTER TABLE capability.health ADD COLUMN IF NOT EXISTS semantic_version INTEGER;
|
||||
ALTER TABLE capability.health ADD COLUMN IF NOT EXISTS observed_at_unix_millis BIGINT;
|
||||
UPDATE capability.health SET semantic_version = 1 WHERE semantic_version IS NULL;
|
||||
ALTER TABLE capability.health ALTER COLUMN semantic_version SET NOT NULL;
|
||||
ALTER TABLE capability.health DROP CONSTRAINT IF EXISTS capability_health_semantic_shape;
|
||||
ALTER TABLE capability.health ADD CONSTRAINT capability_health_semantic_shape CHECK ((semantic_version = 1 AND observed_at_unix_millis IS NULL) OR (semantic_version = 2 AND observed_at_unix_millis > 0));
|
||||
CREATE TABLE IF NOT EXISTS capability.health_projection (
|
||||
capability_id TEXT PRIMARY KEY,
|
||||
state TEXT NOT NULL,
|
||||
reason TEXT NOT NULL,
|
||||
revision BIGINT NOT NULL,
|
||||
semantic_version INTEGER NOT NULL,
|
||||
observed_at_unix_millis BIGINT
|
||||
);
|
||||
RESET ROLE;
|
||||
COMMIT;
|
||||
@@ -0,0 +1,3 @@
|
||||
# artifact migrations
|
||||
|
||||
Only the `artifact` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
@@ -0,0 +1,3 @@
|
||||
# authority migrations
|
||||
|
||||
Only the `authority` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
@@ -0,0 +1,3 @@
|
||||
# capability migrations
|
||||
|
||||
Only the `capability` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
@@ -0,0 +1,3 @@
|
||||
# commit migrations
|
||||
|
||||
Only the `commit` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
@@ -0,0 +1,3 @@
|
||||
# continuity migrations
|
||||
|
||||
Only the `continuity` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
@@ -0,0 +1,3 @@
|
||||
# epistemics migrations
|
||||
|
||||
Only the `epistemics` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
@@ -0,0 +1,3 @@
|
||||
# identity migrations
|
||||
|
||||
Only the `identity` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
@@ -0,0 +1,3 @@
|
||||
# situation migrations
|
||||
|
||||
Only the `situation` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
@@ -0,0 +1,3 @@
|
||||
# work migrations
|
||||
|
||||
Only the `work` semantic owner may introduce canonical writes in this schema. Migrations must be explicit, versioned and tested.
|
||||
Reference in New Issue
Block a user