Closed sarajmunjal closed 1 year ago
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 sorry if this is the wrong place to ask, but what's the process to get a new version released with this PR?
@sarajmunjal I just pushed version 1.5.0
!
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 testTestContextTimeout
.