Initial import of streamline
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
-- 业务域 — knowledge ownership and subscription.
|
||||
--
|
||||
-- A domain is a MUTABLE many-to-one label over claims. It is deliberately not
|
||||
-- scope_key: that column is the arbitration conflict key, and it must stay
|
||||
-- byte-stable forever or historical "did these two claims collide?" answers
|
||||
-- change retroactively. Org structure does not have that property, so it gets
|
||||
-- its own layer that can be recomputed at will (kb_domains.ts::reattributeAll).
|
||||
--
|
||||
-- Knowledge remains globally shared: nothing in retrieval reads domain_key. This
|
||||
-- table answers "who should look at this when it's contested", never "who may
|
||||
-- use it".
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "kb_domains" (
|
||||
"key" text PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"owner_group" text,
|
||||
"owner_email" text,
|
||||
"match_rules" text NOT NULL,
|
||||
"priority" bigint DEFAULT 100 NOT NULL,
|
||||
"created_by" text,
|
||||
"created_at" bigint NOT NULL,
|
||||
"updated_at" bigint NOT NULL
|
||||
);
|
||||
|
||||
-- NULL = unattributed, which is the INPUT to the clustering suggestions rather
|
||||
-- than an error — hence nullable with no default and no FK: deleting a domain
|
||||
-- nulls its claims explicitly (deleteDomain), and a dangling key would hide
|
||||
-- claims from both the domain filter and the unattributed list at once.
|
||||
ALTER TABLE "kb_claims" ADD COLUMN IF NOT EXISTS "domain_key" text;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "kb_claims_domain_idx" ON "kb_claims" ("domain_key");
|
||||
Reference in New Issue
Block a user