fix(schema): add metadata and thread_id to dependencies expectedSchema

**Problem:**
Schema compatibility probe was failing with "no such column: thread_id"
error when opening databases created before v0.30.5, even after running
migrations. This caused database initialization to fail.
**Root Cause:**
The migration 020_edge_consolidation.go correctly adds the metadata and
thread_id columns to the dependencies table, but schema_probe.go's
expectedSchema map was missing these columns in its validation list.
This caused verifySchemaCompatibility() to fail even though:
1. The columns existed in the actual schema (schema.go:51-52)
2. Migration 020 would add them if missing
3. The database was otherwise valid
**Solution:**
Updated expectedSchema in schema_probe.go to include "metadata" and
"thread_id" in the dependencies table column list. This aligns the schema
probe expectations with the actual schema definition and migration 020
behavior.
**Testing:**
 Tested on 5 databases across version range pre-0.17.5 → v0.30.5
   - All migrations completed successfully
   - Schema probe passes after migration
   - All bd commands work correctly
 No regressions in fresh database initialization
**Impact:**
- Fixes database initialization errors for users upgrading from v0.30.3
- No breaking changes or data migrations required
- Compatible with all existing databases
- Enables smooth migration path for all database versions
Fixes database migration issues reported in v0.30.5 upgrade path.
🤖 Generated with Claude Code
This commit is contained in:
Marco Del Pin
2025-12-18 17:48:21 +01:00
parent 7c8b69f5b3
commit d5e569443d

View File

@@ -19,7 +19,7 @@ var expectedSchema = map[string][]string{
"created_at", "updated_at", "closed_at", "content_hash", "external_ref",
"compaction_level", "compacted_at", "compacted_at_commit", "original_size",
},
"dependencies": {"issue_id", "depends_on_id", "type", "created_at", "created_by"},
"dependencies": {"issue_id", "depends_on_id", "type", "created_at", "created_by", "metadata", "thread_id"},
"labels": {"issue_id", "label"},
"comments": {"id", "issue_id", "author", "text", "created_at"},
"events": {"id", "issue_id", "event_type", "actor", "old_value", "new_value", "comment", "created_at"},