fix(db): add migration to create shared_links table for databases that skipped 025

Migration 025_add_shared_links was inserted into the Alembic chain
(between 024_add_api_tokens and 025_add_user_notifications) after some
databases had already been migrated past that point. Those databases
never had the shared_links table created, causing OperationalError when
the expire-shared-links scheduled task runs or when users try to create
shared links.

This commit:
- Adds migration 027_ensure_shared_links_table that idempotently creates
  the table if it doesn't exist
- Updates migrations/env.py to import all models for autogenerate support
- Adds shared_links to db_migrate.py _TABLE_ORDER for proper migration
  ordering
- Adds a regression test verifying the fix

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-10 00:01:33 +00:00
parent 73295cad33
commit 289dcc375c
4 changed files with 157 additions and 0 deletions
+1
View File
@@ -34,6 +34,7 @@ _TABLE_ORDER = [
"settings_audit_log",
"saved_searches",
"webhook_configs",
"shared_links",
]