{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/daniloaguiarbr/sqlite-graphrag/schemas/debug-schema.schema.json",
"title": "DebugSchemaResponse",
"description": "Response emitted by the hidden `sqlite-graphrag __debug_schema` subcommand on stdout as a single JSON line. Intended for diagnostic tooling only. The binary exposes this command as `__debug_schema` (double-underscore prefix) while this schema file uses the kebab-case convention `debug-schema.schema.json`. IMPORTANT: `user_version` and `schema_version` are INTENTIONALLY UNRELATED values that serve distinct purposes. `user_version` is a project-signature constant (SCHEMA_USER_VERSION = 49) baked into the binary so external tools (`sqlite3 ... 'PRAGMA user_version'`, the `file` command, SQLite browsers) can identify a sqlite-graphrag database at a glance. It does NOT track the migration count. `schema_version` is `MAX(version)` from `refinery_schema_history` (the last applied migration, currently 9 after V009). The constants are independent: bumping migrations does not touch `user_version` and vice versa.",
"$defs": {
"SchemaObject": {
"type": "object",
"required": ["name", "type"],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"type": { "type": "string", "enum": ["table", "view", "trigger", "index"] }
}
},
"MigrationRecord": {
"type": "object",
"required": ["version", "name", "applied_on"],
"additionalProperties": false,
"properties": {
"version": { "type": "integer" },
"name": { "type": "string" },
"applied_on": { "type": "string", "description": "ISO 8601 timestamp string." }
}
}
},
"type": "object",
"required": ["schema_version", "user_version", "objects", "migrations", "elapsed_ms"],
"additionalProperties": false,
"properties": {
"schema_version": { "type": "integer", "description": "MAX(version) from refinery_schema_history — the last migration actually applied to this database file. Grows by 1 per migration." },
"user_version": { "type": "integer", "description": "SQLite PRAGMA user_version — project-signature constant SCHEMA_USER_VERSION (49) baked into the binary. Independent from migration count; serves as an external-tool marker only." },
"objects": { "type": "array", "items": { "$ref": "#/$defs/SchemaObject" } },
"migrations": { "type": "array", "items": { "$ref": "#/$defs/MigrationRecord" } },
"elapsed_ms": { "type": "integer", "minimum": 0 }
}
}