-
Notifications
You must be signed in to change notification settings - Fork 48
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
Add MigrationHooks
API to allow custom behaviour during migration start
#290
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exekias
reviewed
Feb 28, 2024
andrew-farries
added a commit
that referenced
this pull request
Feb 29, 2024
Separate the DDL operations required during migration start from the DML operations (backfills). Complete all DDL steps before starting DML. Each `Start` operation returns the name of the table that requires backfill, if any. After all operations have started, backfills are run on each table that requires one. Separating DDL and DML during migration start like this will allow for setting Postgres options that should apply only for the DDL phase of migration start (as in #290).
Add an option to allow a specific Postgres setting to be enabled on migration start. This is useful when a migration requires a setting to be enabled for the duration of the start operation. The setting will be disabled after the migration start phase has finished.
andrew-farries
force-pushed
the
enable-setting-on-migration-start
branch
from
February 29, 2024 06:40
aceeb19
to
49e738c
Compare
Allow a `Roll` to take migration hooks to be executed at various points in the migration.
Check that the hooks are invoked.
exekias
approved these changes
Feb 29, 2024
andrew-farries
changed the title
Add two new options to help with replication control
Add Feb 29, 2024
MigrationHooks
API to allow custom behaviour during migration start
This was referenced Mar 1, 2024
Merged
andrew-farries
added a commit
that referenced
this pull request
Mar 7, 2024
Remove the `BeforeBackfill` hook. The `BeforeBackfill` hook was added along with the `BeforeStartDDL` and `AfterStartDDL` hooks in #290, but is of limited use as a hook that runs only after successful execution of start phase DDL. Prefer a simpler API with fewer hooks until there is a demonstrated need for it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add two new migration options:
WithSettingsOnMigrationStart
: defines a map of Postgres setting/value pairs to be set for the duration of the DDL phase of migration start. Settings will be restored to their previous values once the DDL phase is complete.WithKickstartReplication
: defines an option that when set will make a no-op schema change in between completing the DDL operations for migration start and performing backfills. This can be used to ensure that schema replication is up-to-date before starting backfills.Neither of these options are exposed via the CLI; they are intended for use by
pgroll
integrators, ie modules usingpgroll
as a Go dependency.