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

[WIP] - v4-alpha.1 #502

Closed
wants to merge 22 commits into from
Closed

[WIP] - v4-alpha.1 #502

wants to merge 22 commits into from

Conversation

mfridman
Copy link
Collaborator

@mfridman mfridman commented Apr 16, 2023

This is a continuation of #484, all commits have been squashed from that branch.

There will be a separate place to capture all the additions, changes, removals and fixes.

The goal of these alpha branches is to continue polishing up the PR, making sure the package is idiomatic, has good test coverage and supports the main features. There will be breaking changes along the alpha branches, less in the beta, and little in the release candidates.


Here's the current plan for rollout:

alpha.N

  • How to handle partial migration failures, see comment
  • Re-add goose_test.go from the /v3 module
    • Add additional locking tests with built binaries
    • Use t.TempDir() instead of building to the local filesystem
  • Add goose init command
  • Make decision on whether to pass ctx to the Go register functions such as GoMigration and GoMigrationNoTx

beta.N

  • Revisit method specific options vs provider options, see comment
  • Add mutex to *goose.Provider (maybe?)
  • Add back mysql-specific -certfile, -ssl-cert, and -ssl-key
  • Fix CLI output and add JSON where appropriate

rc.N (release candidate)

  • Add support for Grouped Migrations feature
  • Add goose validate command

Rationale

Make a decision on whether to pass ctx to the Go register functions such as GoMigration and GoMigrationNoTx

I think it makes sense to break the register functions and force the user to write context-aware functions. It's become a standard in the Go community to pass down the context for request-scoped values, cancelation signals, and deadlines.

In this case, goose may receive a termination signal and it should be possible for the registered Go function to respect this signal and gracefully handle it.

// GoMigration is a Go migration func that is run within a transaction.
- type GoMigration func(tx *sql.Tx) error
+ type GoMigration func(ctx context.Context, tx *sql.Tx) error

// GoMigrationNoTx is a Go migration func that is run outside a transaction.
- type GoMigrationNoTx func(db *sql.DB) error
+ type GoMigrationNoTx func(ctx context.Context, db *sql.DB) error

@mfridman mfridman force-pushed the v4-alpha.1 branch 2 times, most recently from 1e3c9e4 to 15e65c7 Compare April 16, 2023 12:58
@mfridman mfridman added the /v4 label Apr 16, 2023
@mfridman mfridman added this to the Up next in v4 milestone Apr 16, 2023
@mfridman mfridman mentioned this pull request Apr 25, 2023
7 tasks
@mfridman
Copy link
Collaborator Author

Closing in favor of #507

@mfridman mfridman closed this Apr 25, 2023
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.

None yet

1 participant