fix(schema): add pinned column to schema compatibility checks

The schema_probe.go and doctor/database.go had different column lists
for validating database schemas. Neither included the pinned column
added in migration 023, causing:
- Doctor to report "All required tables and columns present" on
  databases missing the pinned column
- Potential failures when using `gt mail send` on databases without
  the pinned column

Changes:
- Add pinned, sender, ephemeral to doctor's criticalChecks
- Add metadata, thread_id to dependencies check
- Add all missing columns to schema_probe.go's expectedSchema:
  source_repo, close_reason, deleted_at, deleted_by, delete_reason,
  original_type, sender, ephemeral, pinned

Fixes: beads-9yc

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 19:57:14 -08:00
parent 46488d4f96
commit 567dd0a0c6
2 changed files with 5 additions and 2 deletions

View File

@@ -173,8 +173,8 @@ func CheckSchemaCompatibility(path string) DoctorCheck {
// This is a simplified version since we can't import the internal package directly
// Check all critical tables and columns
criticalChecks := map[string][]string{
"issues": {"id", "title", "content_hash", "external_ref", "compacted_at", "close_reason"},
"dependencies": {"issue_id", "depends_on_id", "type"},
"issues": {"id", "title", "content_hash", "external_ref", "compacted_at", "close_reason", "pinned", "sender", "ephemeral"},
"dependencies": {"issue_id", "depends_on_id", "type", "metadata", "thread_id"},
"child_counters": {"parent_id", "last_child"},
"export_hashes": {"issue_id", "content_hash"},
}

View File

@@ -18,6 +18,9 @@ var expectedSchema = map[string][]string{
"status", "priority", "issue_type", "assignee", "estimated_minutes",
"created_at", "updated_at", "closed_at", "content_hash", "external_ref",
"compaction_level", "compacted_at", "compacted_at_commit", "original_size",
"source_repo", "close_reason",
"deleted_at", "deleted_by", "delete_reason", "original_type",
"sender", "ephemeral", "pinned",
},
"dependencies": {"issue_id", "depends_on_id", "type", "created_at", "created_by", "metadata", "thread_id"},
"labels": {"issue_id", "label"},