-
Notifications
You must be signed in to change notification settings - Fork 232
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
Support for repeatable migrations #2784
Comments
A simpler solution/workaround would be to extend |
Great suggestion! 👍 To build on it, a |
I think the main benefit of repeatable migration is to reduce code duplication. But after some initial exploration by @JohnBra, the cost involves changes to migration list and db reset commands which seem fairly complex. So taking a step back, may I suggest using declarative schemas instead? For eg. you can define views and functions in
To diff the declared schemas, remember to stop the local database first. |
I'm not sure the declarative approach is the best way to go:
If this would be integrated into other commands ( I do see the good side of it though, having one |
Is your feature request related to a problem? Please describe.
When updating definitions for objects such as views or functions, a new migration is required, which means we have to duplicate the definition to add the necessary modification.
Describe the solution you'd like
Have some repeatable migrations that are applied with each
migration up
command, something similar to Flyway's Repeatable MigrationsLet's say we have these files in the
migrations
folderRunning
migration up
would applymigration_1
and thenmy_view_or_function
(it can usecurrent_timestamp
as version).We now add a new migration:
Running
migration up
would skipmigration_1
, applymigration_2
, and then re-applymy_view_or_function
(with a differentcurrent_timestamp
as version).Describe alternatives you've considered
Manually executing
r_my_view_or_function.sql
after applying migrations by connecting to the database directlyAdditional context
N/A
The text was updated successfully, but these errors were encountered: