3.1 Schema Version
Every hive database carries a schema version in a single-row table :
(
version INTEGER NOT NULL
);
The supported schema version is 1.
loregd checks the version as it opens each database (§2.2, step 4) and takes one of three paths:
| State | behavior |
|---|---|
No schema_version table | The database is new. loregd creates the persistent tables, the volatile tables, and inserts version 1, all in one transaction. |
| Version equals 1 | Normal startup. |
| Version greater than 1 | Startup fails. The database was written by a newer loregd, and proceeding risks corrupting it by writing through an older understanding of its layout. |
| Version less than 1 | Startup fails. |
There are no migrations. loregd carries no migration table, no migration step list, and no upgrade path; an older database is reported as requiring migration and startup stops there. The version check does not convert existing data to another layout.
The schema_version table
has no primary key, uniqueness constraint, or check constraint, so a
second row is not detected: the first row read wins.
And because every table is created with IF NOT EXISTS, a database
holding the data tables but no schema_version table is stamped as
version 1 without any validation that its contents match that layout.