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:
@@ -20,13 +20,28 @@ from app.database import Base
|
||||
|
||||
# Ensure all models are imported so Base.metadata is populated.
|
||||
from app.models import ( # noqa: F401
|
||||
ApiToken,
|
||||
ApplicationSettings,
|
||||
BackupRecord,
|
||||
DocumentMetadata,
|
||||
FileProcessingStep,
|
||||
FileRecord,
|
||||
InAppNotification,
|
||||
LocalUser,
|
||||
Pipeline,
|
||||
PipelineStep,
|
||||
ProcessingLog,
|
||||
SavedSearch,
|
||||
ScheduledJob,
|
||||
SettingsAuditLog,
|
||||
SharedLink,
|
||||
SubscriptionPlan,
|
||||
UserImapAccount,
|
||||
UserIntegration,
|
||||
UserNotificationPreference,
|
||||
UserNotificationTarget,
|
||||
UserProfile,
|
||||
WebhookConfig,
|
||||
)
|
||||
|
||||
# Alembic Config object – provides access to values in alembic.ini.
|
||||
|
||||
Reference in New Issue
Block a user