Index beta evidence and foreign key child lookups

This commit is contained in:
2026-10-06 13:57:22 -04:00
parent 8e948c07d9
commit 27be1abf41
6 changed files with 77 additions and 0 deletions
+2
View File
@@ -89,6 +89,8 @@ export function ensureHostSchema(handle: Database.Database): void {
CHECK(stage IN ('queued','running','cleaned','failed','completed')),
requested_at TEXT NOT NULL, updated_at TEXT NOT NULL, cleaned_at TEXT, error TEXT
);
CREATE INDEX IF NOT EXISTS idx_ec_host_credentials_host ON ec_host_credentials(host_id);
CREATE INDEX IF NOT EXISTS idx_ec_host_enrollments_host ON ec_host_enrollments(host_id);
`);
const columns = handle.prepare('PRAGMA table_info(ec_host_operations)').all() as { name: string }[];
if (!columns.some(column => column.name === 'history_expired_at')) handle.exec('ALTER TABLE ec_host_operations ADD COLUMN history_expired_at TEXT');