diff --git a/cmd/sql-migrate/examples/ms-todos/go.mod b/cmd/sql-migrate/examples/ms-todos/go.mod index 8a728ea..342d858 100644 --- a/cmd/sql-migrate/examples/ms-todos/go.mod +++ b/cmd/sql-migrate/examples/ms-todos/go.mod @@ -17,3 +17,8 @@ require ( golang.org/x/crypto v0.48.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 +) diff --git a/cmd/sql-migrate/examples/ms-todos/go.sum b/cmd/sql-migrate/examples/ms-todos/go.sum index 8690555..dc711c4 100644 --- a/cmd/sql-migrate/examples/ms-todos/go.sum +++ b/cmd/sql-migrate/examples/ms-todos/go.sum @@ -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/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= 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/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= diff --git a/cmd/sql-migrate/examples/ms-todos/main.go b/cmd/sql-migrate/examples/ms-todos/main.go index 35ab9b0..d913ad6 100644 --- a/cmd/sql-migrate/examples/ms-todos/main.go +++ b/cmd/sql-migrate/examples/ms-todos/main.go @@ -70,8 +70,16 @@ func main() { } 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() - runner := msmigrate.New(db) + runner := msmigrate.New(conn) subcmd := args[0] subArgs := args[1:]