-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
feat: Adds helper functions for migrations #31303
feat: Adds helper functions for migrations #31303
Conversation
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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #31303 +/- ##
===========================================
+ Coverage 60.48% 83.73% +23.24%
===========================================
Files 1931 537 -1394
Lines 76236 39061 -37175
Branches 8568 0 -8568
===========================================
- Hits 46114 32709 -13405
+ Misses 28017 6352 -21665
+ Partials 2105 0 -2105
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Not directly related but I've been considering squashing old migration into a big large initial one, keeping say 2 years worth or migrations or since say 2.x |
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.
Thank you for the valuable PR @luizotavio32. I left some comments.
… skipn on count <= 0
SUMMARY
This PR aims to implement helper functions that will provide standard interfaces for the most used methods found in the migrations for the past 2 years, which are: create and drop tables, add and drop columns, create and drop indexes. Another objective to make logging standard among migrations by providing more human readable logs and displaying the same type of information.
These new functions will apply some validations before executing such as:
These types of validations will make the migrations more resilient. The added helper functions and their logs are:
There’s also a new method for executing database operations in batch. This function will receive a
Callable
, thecount
andbatch_size
as the parameters. When executing, theCallable
will receive the offset and limit for the current processed batch.TESTING INSTRUCTIONS
Execute the migrations using
superset db upgrade
and superset db downgrade` commands and make sure everything works as expected.ADDITIONAL INFORMATION