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

litemigrate.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:04 -06:00
parent b9ef91af1d
commit ef5b86b5b0
No known key found for this signature in database
3 changed files with 14 additions and 5 deletions

View File

@ -21,3 +21,8 @@ require (
modernc.org/mathutil v1.7.1 // indirect modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect modernc.org/memory v1.11.0 // indirect
) )
replace (
github.com/therootcompany/golib/database/sqlmigrate => ../../../../database/sqlmigrate
github.com/therootcompany/golib/database/sqlmigrate/litemigrate => ../../../../database/sqlmigrate/litemigrate
)

View File

@ -12,10 +12,6 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
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/litemigrate v1.0.2 h1:Tk6qWqmk9xqcbt6KOP51QrPQMsZVCtIJ3ad6220Q/yY=
github.com/therootcompany/golib/database/sqlmigrate/litemigrate v1.0.2/go.mod h1:FBLUKs9lMeahcR0OTiL4yi9bD14Mqj0judkMTma+aB0=
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM= golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8= golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8=
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=

View File

@ -69,8 +69,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 := litemigrate.New(db) runner := litemigrate.New(conn)
subcmd := args[0] subcmd := args[0]
subArgs := args[1:] subArgs := args[1:]