-
-
Notifications
You must be signed in to change notification settings - Fork 751
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
chore: Improve Alembic Migration Generation #4192
chore: Improve Alembic Migration Generation #4192
Conversation
@@ -202,8 +202,6 @@ def downgrade(): | |||
) | |||
op.drop_index(op.f("ix_recipes_rating"), table_name="recipes") | |||
op.alter_column("recipes", "rating", existing_type=sa.Float(), type_=sa.INTEGER(), existing_nullable=True) | |||
op.create_unique_constraint("ingredient_units_name_group_id_key", "ingredient_units", ["name", "group_id"]) | |||
op.create_unique_constraint("ingredient_foods_name_group_id_key", "ingredient_foods", ["name", "group_id"]) |
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.
Other than type hints, this is the only change made to actual migration code. This is in the downgrade method though, which we don't use. These lines shouldn't be there.
Is there any regression testing that can be/was done on this? |
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.
LGTM - will be great to have Alembic be a smoother process! 🚀
Couple comments.
Regarding regression testing - the closest thing we have is some migration tests. We have test data from various migrations which are all run against the existing migration scripts, and we check some known previous data issues. So since test pass we know older versions can still migrate to the latest version, and that the data isn't messed up (in specific instances) |
What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
This PR modifies Alembic to make generating migrations easier. It makes the following changes:
I also updated the
database-changes
docs to remove the blurb about batch operations, since that's now done automatically.Which issue(s) this PR fixes:
(REQUIRED)
N/A
Testing
(fill-in or delete this section)
I created a migration using these changes and confirmed: