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 <noreply@anthropic.com>
This commit is contained in:
rob 2026-01-13 23:24:48 -04:00
parent 58f187ccad
commit 50326a11c6
1 changed files with 2 additions and 3 deletions

View File

@ -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,