-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Improvement] Make Alembic migrations idempotent #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@CREDO23 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by RecurseML
🔍 Review performed on f3f661f..443e877
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (8)
• surfsense_backend/alembic/versions/10_update_chattype_enum_to_qna_report_structure.py
• surfsense_backend/alembic/versions/1_add_github_connector_enum.py
• surfsense_backend/alembic/versions/24_fix_null_chat_types.py
• surfsense_backend/alembic/versions/34_add_podcast_staleness_detection.py
• surfsense_backend/alembic/versions/49_migrate_old_chats_to_new_chat.py
• surfsense_backend/alembic/versions/52_rename_llm_preference_columns.py
• surfsense_backend/alembic/versions/55_rename_google_drive_connector_to_file.py
• surfsense_backend/alembic/versions/5_remove_title_char_limit.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by RecurseML
🔍 Review performed on 443e877..924e621
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (2)
• surfsense_backend/alembic/versions/0_initial_schema.py
• surfsense_backend/alembic/versions/1_add_github_connector_enum.py
Description
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR makes Alembic database migrations idempotent by adding existence checks before applying schema changes. Each migration now verifies that tables and enums exist before attempting to modify them, and checks that columns don't already exist before creating or renaming them. This allows migrations to be safely re-run on fresh databases or in cases where the schema is already in the desired state, preventing errors from duplicate operations.
⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
surfsense_backend/alembic/versions/1_add_github_connector_enum.pysurfsense_backend/alembic/versions/5_remove_title_char_limit.pysurfsense_backend/alembic/versions/24_fix_null_chat_types.pysurfsense_backend/alembic/versions/34_add_podcast_staleness_detection.pysurfsense_backend/alembic/versions/10_update_chattype_enum_to_qna_report_structure.pysurfsense_backend/alembic/versions/49_migrate_old_chats_to_new_chat.pysurfsense_backend/alembic/versions/52_rename_llm_preference_columns.pysurfsense_backend/alembic/versions/55_rename_google_drive_connector_to_file.py