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

Add context support to Exec methods #247

Merged
merged 2 commits into from
Jun 5, 2023
Merged

Conversation

sarajmunjal
Copy link
Contributor

What
This PR allows passing Go native context to Exec/ExecMax methods declared globally and on the MigrationSet struct.

Why
Golang contexts are an elegant way to control program flow. With Exec methods, contexts will enable timing out while running large migrations. In production, long-running DDL migration queries on large tables can obtain exclusive locks and cause downtime.
Behavior can be seen in the newly added test TestContextTimeout.

@rubenv
Copy link
Owner

rubenv commented Jun 5, 2023

Would have added context parameters in the first place if I were to start sql-migrate nowadays, but sadly it predates it.

Adding them with extra methods feels consistent with the rest of the standard library. Also really like the added unit test.

Good stuff!

@rubenv rubenv merged commit 61ee1bf into rubenv:master Jun 5, 2023
@sarajmunjal
Copy link
Contributor Author

@rubenv sorry if this is the wrong place to ask, but what's the process to get a new version released with this PR?

@rubenv
Copy link
Owner

rubenv commented Jun 23, 2023

@sarajmunjal I just pushed version 1.5.0!

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.

2 participants