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>