Skip to content
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

[/v4] - Add support for grouped migrations (prefactor) #494

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

mfridman
Copy link
Collaborator

@mfridman mfridman commented Apr 3, 2023

Added a helper function that takes a list of migrations and groups them by whether they are safe to run in a tx or not.

By grouping the migrations we can best effort apply them within the same transaction. See tests or this #485 (comment)

Description:

// GroupedMigrations enables the ability to share a single transaction across multiple migrations.
//
// For more information, see: TODO(mf): add link to docs
//
// For example, say we have 6 new migrations to apply: 11,12,13,14,15,16. But migration 14 is marked
// with -- +goose NO TRANSACTION. Then the migrations will be applied sequentially in 3 groups:
//
//  1. migrations 11,12,13 will be applied in a single transaction and committed
//  2. migration 14 will be applied outside transaction and committed
//  3. migrations 15,16 will be applied in a single transaction and committed
//
// This feature is useful to avoid leaving the database in a partially migrated state. But, keep in
// mind there may be performance implications if you have a large number of migrations.
//
// Default: false

@mfridman mfridman changed the base branch from master to v4 April 3, 2023 00:09
@mfridman mfridman changed the title [/v4] - Add support for grouped migrations [/v4] - Add support for grouped migrations (prefactor) Apr 3, 2023
@mfridman mfridman merged commit e8121b5 into v4 Apr 3, 2023
@mfridman mfridman deleted the v4-grouped-migrations branch April 3, 2023 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant