From 567dd0a0c684afa6e8783a255de2a252724c9886 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Fri, 19 Dec 2025 19:57:14 -0800 Subject: [PATCH] fix(schema): add pinned column to schema compatibility checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cmd/bd/doctor/database.go | 4 ++-- internal/storage/sqlite/schema_probe.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/bd/doctor/database.go b/cmd/bd/doctor/database.go index e9d39174..4c4118a9 100644 --- a/cmd/bd/doctor/database.go +++ b/cmd/bd/doctor/database.go @@ -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"}, } diff --git a/internal/storage/sqlite/schema_probe.go b/internal/storage/sqlite/schema_probe.go index b06c8174..124a70ca 100644 --- a/internal/storage/sqlite/schema_probe.go +++ b/internal/storage/sqlite/schema_probe.go @@ -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"},