Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/cortex/blob/main/tests/import/schema.sql # cortex aien-dev/cortex Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `cortex / tests / import / schema.sql` 51 lines ยท 2156 bytes Raw Blame History 1 -- cortex-rs 0.1.0 src/db.rs init_schema SQL, copied verbatim (lines 41-90) for synthetic fixtures. 2 CREATE TABLE IF NOT EXISTS spaces ( 3 id TEXT PRIMARY KEY, 4 slug TEXT UNIQUE NOT NULL, 5 created_at TEXT NOT NULL 6 ); 7 8 CREATE TABLE IF NOT EXISTS entities ( 9 id TEXT PRIMARY KEY, 10 space_id TEXT NOT NULL, 11 space_slug TEXT NOT NULL, 12 entity_type TEXT NOT NULL, 13 canonical_name TEXT NOT NULL, 14 content TEXT NOT NULL, 15 aliases_json TEXT NOT NULL DEFAULT '[]', 16 metadata_json TEXT NOT NULL DEFAULT '{}', 17 confidence REAL NOT NULL DEFAULT 1.0, 18 revision INTEGER NOT NULL DEFAULT 1, 19 retracted INTEGER NOT NULL DEFAULT 0, 20 valid_from TEXT, 21 valid_to TEXT, 22 created_at TEXT NOT NULL, 23 embedding BLOB 24 ); 25 26 CREATE INDEX IF NOT EXISTS idx_entities_canonical ON entities(space_slug, canonical_name); 27 CREATE INDEX IF NOT EXISTS idx_entities_type ON entities(space_slug, entity_type); 28 29 CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5( 30 id UNINDEXED, 31 canonical_name, 32 content, 33 space_slug UNINDEXED 34 ); 35 36 CREATE TABLE IF NOT EXISTS claims ( 37 id TEXT PRIMARY KEY, 38 space_id TEXT NOT NULL, 39 space_slug TEXT NOT NULL, 40 subject_entity_id TEXT NOT NULL, 41 predicate TEXT NOT NULL, 42 object_entity_id TEXT, 43 literal_value_json TEXT, 44 confidence REAL NOT NULL DEFAULT 1.0, 45 metadata_json TEXT NOT NULL DEFAULT '{}', 46 retracted INTEGER NOT NULL DEFAULT 0, 47 created_at TEXT NOT NULL 48 ); 49 50 CREATE INDEX IF NOT EXISTS idx_claims_subject ON claims(subject_entity_id); 51 CREATE INDEX IF NOT EXISTS idx_claims_object ON claims(object_entity_id);