Skip to main content

Module schema

Module schema 

Source
Expand description

Database schema creation and management.

§Versioned migration system

The schema is versioned via the kg_schema_version table (single-row). Call ensure_schema on every database open to apply any pending migrations automatically.

VersionChanges
1Initial schema: entities, relations, vectors, hyperedges, turboquant cache
2Add vectors_checksum column to kg_turboquant_cache

Functions§

create_schema
Create the knowledge graph schema in the database.
ensure_schema
Ensure the database schema is up to date, running any pending migrations.
schema_exists
Check if the core schema tables exist (used for legacy-DB detection).
schema_version
Return the current schema version stored in the database.