Conversation
Prevents errors when migrations are re-run against a database that already has (or has already dropped) the target tables. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ndex ops Prevents errors when migrations are re-run against a database that already has (or has already dropped) the target indexes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Makes Alembic migrations more resilient to partial runs by adding if_not_exists=True / if_exists=True to schema operations, and bumps Alembic to a version that supports these flags.
Changes:
- Add
if_not_exists=Truetocreate_table,add_column, andcreate_indexmigration operations. - Add
if_exists=Truetodrop_table,drop_column, anddrop_indexmigration operations. - Update Alembic dependency/lockfile (plus minor whitespace-only edits in a few non-migration files).
Reviewed changes
Copilot reviewed 61 out of 62 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Updates lockfile (notably Alembic version/resolution metadata). |
| pyproject.toml | Bumps Alembic dependency constraint to ~=1.16. |
| backend/tests/handler/metadata/test_base_handler.py | Removes stray blank lines (format-only). |
| backend/tests/endpoints/test_device.py | Removes stray blank lines (format-only). |
| backend/endpoints/search.py | Removes stray blank line (format-only). |
| backend/alembic/versions/2.0.0_.py | Adds if_(not_)exists flags to table/index create/drop. |
| backend/alembic/versions/1.8.3_.py | Removes autogenerated Alembic comment wrappers (no-op). |
| backend/alembic/versions/1.8.2_.py | Removes autogenerated Alembic comment wrappers (no-op). |
| backend/alembic/versions/1.8.1_.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/1.8_.py | Adds if_(not_)exists flags across create/drop and add/drop column ops. |
| backend/alembic/versions/1.7.1_.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/1.6.3_.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/1.6.2_.py | Replaces try/except with if_not_exists / if_exists create/drop tables. |
| backend/alembic/versions/0075_sync_sessions.py | Adds if_(not_)exists flags; also changes how sync_config is added/dropped. |
| backend/alembic/versions/0073_sibling_roms_metadata_only.py | Adds if_(not_)exists flags for index ops. |
| backend/alembic/versions/0072_client_tokens.py | Adds if_(not_)exists flags for table/index ops. |
| backend/alembic/versions/0069_sibling_roms_fs_name.py | Adds if_(not_)exists flags for index ops. |
| backend/alembic/versions/0068_save_sync.py | Adds if_(not_)exists flags for tables/columns/indexes and corresponding drops. |
| backend/alembic/versions/0065_collections_updated_at_idx.py | Adds if_(not_)exists flags for index ops. |
| backend/alembic/versions/0064_add_updated_at_indexes.py | Adds if_(not_)exists flags for index ops. |
| backend/alembic/versions/0061_manual_metadata.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0060_user_ui_settings.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0059_rom_version_tag.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0057_multi_notes.py | Adds if_(not_)exists flags for table/index ops and column restores in downgrade. |
| backend/alembic/versions/0056_gamelist_xml.py | Adds if_(not_)exists flags for add/drop column + index ops. |
| backend/alembic/versions/0055_collection_is_favorite.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0054_add_platform_metadata_slugs.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0053_add_hltb_metadata.py | Adds if_(not_)exists flags for add/drop column + index ops. |
| backend/alembic/versions/0051_flashpoint_metadata.py | Adds if_(not_)exists flags for add/drop column + index ops. |
| backend/alembic/versions/0050_firmware_add_is_verified.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0049_add_fs_size_bytes.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0047_smart_collections.py | Adds if_(not_)exists flags for table drop. |
| backend/alembic/versions/0046_migrate_platform_slugs.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0044_hasheous_id.py | Adds if_(not_)exists flags for add/drop column + index ops. |
| backend/alembic/versions/0043_launchbox_id.py | Adds if_(not_)exists flags for add/drop column + index ops. |
| backend/alembic/versions/0042_add_missing_from_fs.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0039_add_retro_achievements.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0036_screenscraper_platforms_id.py | Removes autogenerated Alembic comment wrappers (no-op). |
| backend/alembic/versions/0035_screenscraper.py | Adds if_(not_)exists flags for add/drop column + index ops. |
| backend/alembic/versions/0034_virtual_collections_db_view.py | Adds if_(not_)exists flags for table/column ops. |
| backend/alembic/versions/0033_rom_file_and_hashes.py | Adds if_(not_)exists flags for table/column/index drops and restores. |
| backend/alembic/versions/0032_longer_fs_fields.py | Removes autogenerated Alembic comment wrappers (no-op). |
| backend/alembic/versions/0031_datetime_to_timestamp.py | Removes autogenerated Alembic comment wrappers (no-op). |
| backend/alembic/versions/0029_platforms_custom_name.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0028_user_email.py | Adds if_(not_)exists flags for add/drop column + index ops. |
| backend/alembic/versions/0027_platforms_data.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0026_romuser_status_fields.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0025_roms_hashes.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0024_sibling_roms_db_view.py | Adds if_(not_)exists flags for index ops. |
| backend/alembic/versions/0022_collections_.py | Adds if_(not_)exists flags for table create/drop. |
| backend/alembic/versions/0021_rom_user.py | Adds if_(not_)exists flags for table create/drop. |
| backend/alembic/versions/0020_created_and_updated.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0019_resources_refactor.py | Removes autogenerated Alembic comment wrappers (no-op). |
| backend/alembic/versions/0018_firmware.py | Adds if_(not_)exists flags for table create/drop. |
| backend/alembic/versions/0017_rom_notes.py | Adds if_(not_)exists flags for table create/drop. |
| backend/alembic/versions/0016_user_last_login_active.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0015_mobygames_data.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0014_asset_files.py | Adds if_(not_)exists flags across table/column ops. |
| backend/alembic/versions/0013_upgrade_file_extension.py | Removes autogenerated Alembic comment wrappers (no-op). |
| backend/alembic/versions/0012_add_regions_languages.py | Adds if_(not_)exists flags for add/drop column ops. |
| backend/alembic/versions/0011_drop_has_cover.py | Adds if_(not_)exists flags for drop/add column ops. |
| backend/alembic/versions/0010_igdb_id_integerr.py | Removes autogenerated Alembic comment wrappers (no-op). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results (mariadb)1 174 tests 1 173 ✅ 3m 0s ⏱️ Results for commit b0a88ff. ♻️ This comment has been updated with latest results. |
Test Results (postgresql)1 174 tests 1 173 ✅ 3m 8s ⏱️ Results for commit b0a88ff. ♻️ This comment has been updated with latest results. |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Summary
Motivation
Makes migrations idempotent so they don't fail when re-run against a database where the target tables, columns, or indexes already exist (or have already been dropped). This improves resilience during partial migration failures and manual recovery scenarios.