fix(ms-todos): use *sql.Conn instead of *sql.DB for migrations

msmigrate.New now requires *sql.Conn. Add replace directives to
use local (unreleased) backend modules.
This commit is contained in:
AJ ONeal 2026-04-09 13:51:33 -06:00
parent 4c5338f16f
commit a1476c48fb
No known key found for this signature in database
3 changed files with 14 additions and 5 deletions

View File

@ -17,3 +17,8 @@ require (
golang.org/x/crypto v0.48.0 // indirect golang.org/x/crypto v0.48.0 // indirect
golang.org/x/text v0.34.0 // indirect golang.org/x/text v0.34.0 // indirect
) )
replace (
github.com/therootcompany/golib/database/sqlmigrate => ../../../../database/sqlmigrate
github.com/therootcompany/golib/database/sqlmigrate/msmigrate => ../../../../database/sqlmigrate/msmigrate
)

View File

@ -34,10 +34,6 @@ github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/therootcompany/golib/database/sqlmigrate v1.0.2 h1:hcmhYyUFVj/GqyChP+0Ry2WZCHnoruFMbsy+2KVzsfA=
github.com/therootcompany/golib/database/sqlmigrate v1.0.2/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
github.com/therootcompany/golib/database/sqlmigrate/msmigrate v1.0.2 h1:pqQX7RIqIuB1N3wALUYI6+gQmwGggTW7BusNZ1B2OzU=
github.com/therootcompany/golib/database/sqlmigrate/msmigrate v1.0.2/go.mod h1:/8Or/f+7lSwspebv4fNagW4gEwJfu/JvfQiOrT8SqDk=
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=

View File

@ -70,8 +70,16 @@ func main() {
} }
defer func() { _ = db.Close() }() defer func() { _ = db.Close() }()
// migrations require a single connection, not a pool
conn, err := db.Conn(ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: acquiring connection for migrations: %v\n", err)
os.Exit(1)
}
defer func() { _ = conn.Close() }()
migrations := mustCollectMigrations() migrations := mustCollectMigrations()
runner := msmigrate.New(db) runner := msmigrate.New(conn)
subcmd := args[0] subcmd := args[0]
subArgs := args[1:] subArgs := args[1:]