From 50326a11c630b0845e86131aa4a8f8afa4ce4065 Mon Sep 17 00:00:00 2001 From: rob Date: Tue, 13 Jan 2026 23:24:48 -0400 Subject: [PATCH] Fix migration: move new column indexes to migrate_db() The index creation for moderation_status, visibility, role, and banned columns was in SCHEMA_SQL which runs before migrate_db(). This caused failures on existing databases that didn't have these columns yet. Co-Authored-By: Claude Opus 4.5 --- src/cmdforge/registry/db.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cmdforge/registry/db.py b/src/cmdforge/registry/db.py index 5bd9604..08d8375 100644 --- a/src/cmdforge/registry/db.py +++ b/src/cmdforge/registry/db.py @@ -243,9 +243,8 @@ CREATE INDEX IF NOT EXISTS idx_content_pages_type ON content_pages(content_type, CREATE INDEX IF NOT EXISTS idx_audit_log_target ON audit_log(target_type, target_id); CREATE INDEX IF NOT EXISTS idx_audit_log_actor ON audit_log(actor_id); CREATE INDEX IF NOT EXISTS idx_audit_log_created ON audit_log(created_at DESC); -CREATE INDEX IF NOT EXISTS idx_tools_moderation ON tools(moderation_status, visibility); -CREATE INDEX IF NOT EXISTS idx_publishers_role ON publishers(role); -CREATE INDEX IF NOT EXISTS idx_publishers_banned ON publishers(banned); +-- Note: idx_tools_moderation, idx_publishers_role, idx_publishers_banned are created +-- in migrate_db() to support upgrading existing databases without these columns CREATE TABLE IF NOT EXISTS pageviews ( id INTEGER PRIMARY KEY AUTOINCREMENT,