You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐛 Schema migration v11→v12 fails to add has_children column #500
Issue 2: Schema Migration v11 to v12 fails to add has_children column
Problem
The migrate_v11_to_v12() migration marks schema version 12 and creates indexes, but fails to add the has_children column to the documents table. This breaks ALL document operations (create/get/list) with:
Error: no such column: has_children in SELECT ... FROM documents
Reproduction
On a database that was created before v0.4.0 and upgraded through multiple versions:
uteke doc create test --content "hello"# Error: Failed to create document: get document by slug: database operation failed
Root Cause
The DB schema_version is already 12 but the has_children column is missing. The column_exists_in() guard in the migration returns false (column doesn't exist), but the ALTER TABLE somehow didn't execute or was rolled back silently while the version was still bumped.
Likely cause: An intermediate binary (v0.4.x dev) ran a partial migration that added some columns and set version 12, but missed has_children. Subsequent migrations are skipped because version is already 12.
Impact
All uteke doc commands fail
All /doc/* HTTP endpoints return 500
uteke repair does NOT fix this (only rebuilds vector index)
Expected
uteke repair should detect and fix missing columns
Confirmed: schema_version is 12 but has_children column is missing.
sqlite3 .tables → documents exists
PRAGMA table_info(documents) → 15 columns, has_children NOT among them
SELECT version FROM schema_version → (12,) exists
idx_documents_path/parent/depth/sort → all exist (created by migration)
documents_fts → does NOT exist (also from migration v11→v12)
The migration ran partially: indexes created, but column addition and FTS creation were skipped. This happens when a v0.4.x intermediate binary ran migration that set version 12 without completing all ALTER TABLE statements.
Fix approach:
Add ensure_documents_has_children() guard in ensure_schema_version() — checks version >= 12 and column exists, adds if missing
Activity
ajianaz commentedon Jun 30, 2026
Root cause analysis
Confirmed: schema_version is 12 but
has_childrencolumn is missing.The migration ran partially: indexes created, but column addition and FTS creation were skipped. This happens when a v0.4.x intermediate binary ran migration that set version 12 without completing all ALTER TABLE statements.
Fix approach:
ensure_documents_has_children()guard inensure_schema_version()— checks version >= 12 and column exists, adds if missinguteke repairto fix partial migrationsajianaz commentedon Jun 30, 2026
Fixed in #504 —
ensure_documents_has_children()runs on every DB open +uteke repairnow fixes schema inconsistencies.Merge develop → main for v0.6.1 release (#507)
fix: ensure has_children column exists for schema v12+ (codecoradev#500)
fix: ensure has_children column exists for schema v12+ (#500)
Merge develop → main for v0.6.1 release (#507)