feat(graphstore): M1 add tier + topic columns to brain_entities (infra#72)
Schema-only change. DDL adds tier + topic on fresh tables and uses ADD COLUMN IF NOT EXISTS on existing tables (idempotent across pod restarts). New conditional indexes match the wing/hall pattern. No behavior change in this commit — UpsertEntity still writes only the original columns; tier + topic stay '' on every row. M2 plumbs the parser through. The empty default means existing queries are untouched until the rest of the chain lands. Part of infra#72 — brain DIKW tier redesign.
This commit is contained in:
@@ -69,12 +69,24 @@ CREATE TABLE IF NOT EXISTS brain_entities (
|
||||
hall TEXT NOT NULL DEFAULT '',
|
||||
doc_path TEXT NOT NULL,
|
||||
title TEXT NOT NULL DEFAULT '',
|
||||
tier TEXT NOT NULL DEFAULT '',
|
||||
topic TEXT NOT NULL DEFAULT '',
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
-- Idempotent migration for clusters created before the DIKW tier
|
||||
-- redesign (infra#72). ADD COLUMN IF NOT EXISTS is safe across
|
||||
-- repeated startups.
|
||||
ALTER TABLE brain_entities
|
||||
ADD COLUMN IF NOT EXISTS tier TEXT NOT NULL DEFAULT '',
|
||||
ADD COLUMN IF NOT EXISTS topic TEXT NOT NULL DEFAULT '';
|
||||
CREATE INDEX IF NOT EXISTS brain_entities_wing_idx
|
||||
ON brain_entities (wing) WHERE wing <> '';
|
||||
CREATE INDEX IF NOT EXISTS brain_entities_type_idx
|
||||
ON brain_entities (type);
|
||||
CREATE INDEX IF NOT EXISTS brain_entities_tier_idx
|
||||
ON brain_entities (tier) WHERE tier <> '';
|
||||
CREATE INDEX IF NOT EXISTS brain_entities_topic_idx
|
||||
ON brain_entities (topic) WHERE topic <> '';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS brain_edges (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user