mirror of
https://github.com/therootcompany/golib.git
synced 2026-04-24 12:48:00 +00:00
ref(backends): update all backends and sql-migrate to sqlmigrate v1.0.2
ExecUp/ExecDown now take (ctx, Migration, sql string) instead of (ctx, Migration) with embedded Up/Down fields. Applied returns []Migration instead of []AppliedMigration. - pgmigrate, mymigrate, litemigrate, msmigrate: new interface, v1.0.2 dep - shmigrate: v1.0.2 dep, remove temporary replace directive - cmd/sql-migrate: v1.0.2 dep
This commit is contained in:
parent
75e4a883b7
commit
5783d4fc7a
@ -4,7 +4,7 @@ go 1.26.1
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/jackc/pgx/v5 v5.9.1
|
github.com/jackc/pgx/v5 v5.9.1
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.0
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2
|
||||||
github.com/therootcompany/golib/database/sqlmigrate/shmigrate v0.0.0
|
github.com/therootcompany/golib/database/sqlmigrate/shmigrate v0.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -2,4 +2,4 @@ module github.com/therootcompany/golib/database/sqlmigrate/litemigrate
|
|||||||
|
|
||||||
go 1.26.1
|
go 1.26.1
|
||||||
|
|
||||||
require github.com/therootcompany/golib/database/sqlmigrate v1.0.1
|
require github.com/therootcompany/golib/database/sqlmigrate v1.0.2
|
||||||
|
|||||||
@ -31,13 +31,13 @@ func New(db *sql.DB) *Migrator {
|
|||||||
var _ sqlmigrate.Migrator = (*Migrator)(nil)
|
var _ sqlmigrate.Migrator = (*Migrator)(nil)
|
||||||
|
|
||||||
// ExecUp runs the up migration SQL inside a transaction.
|
// ExecUp runs the up migration SQL inside a transaction.
|
||||||
func (m *Migrator) ExecUp(ctx context.Context, mig sqlmigrate.Migration) error {
|
func (m *Migrator) ExecUp(ctx context.Context, mig sqlmigrate.Migration, sql string) error {
|
||||||
return m.execInTx(ctx, mig.Up)
|
return m.execInTx(ctx, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecDown runs the down migration SQL inside a transaction.
|
// ExecDown runs the down migration SQL inside a transaction.
|
||||||
func (m *Migrator) ExecDown(ctx context.Context, mig sqlmigrate.Migration) error {
|
func (m *Migrator) ExecDown(ctx context.Context, mig sqlmigrate.Migration, sql string) error {
|
||||||
return m.execInTx(ctx, mig.Down)
|
return m.execInTx(ctx, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Migrator) execInTx(ctx context.Context, sqlStr string) error {
|
func (m *Migrator) execInTx(ctx context.Context, sqlStr string) error {
|
||||||
@ -60,7 +60,7 @@ func (m *Migrator) execInTx(ctx context.Context, sqlStr string) error {
|
|||||||
|
|
||||||
// Applied returns all applied migrations from the _migrations table.
|
// Applied returns all applied migrations from the _migrations table.
|
||||||
// Returns an empty slice if the table does not exist.
|
// Returns an empty slice if the table does not exist.
|
||||||
func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.AppliedMigration, error) {
|
func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.Migration, error) {
|
||||||
rows, err := m.DB.QueryContext(ctx, "SELECT id, name FROM _migrations ORDER BY name")
|
rows, err := m.DB.QueryContext(ctx, "SELECT id, name FROM _migrations ORDER BY name")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// SQLite reports "no such table: _migrations" — stable across versions
|
// SQLite reports "no such table: _migrations" — stable across versions
|
||||||
@ -71,9 +71,9 @@ func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.AppliedMigration,
|
|||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
var applied []sqlmigrate.AppliedMigration
|
var applied []sqlmigrate.Migration
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var a sqlmigrate.AppliedMigration
|
var a sqlmigrate.Migration
|
||||||
if err := rows.Scan(&a.ID, &a.Name); err != nil {
|
if err := rows.Scan(&a.ID, &a.Name); err != nil {
|
||||||
return nil, fmt.Errorf("%w: scanning row: %w", sqlmigrate.ErrQueryApplied, err)
|
return nil, fmt.Errorf("%w: scanning row: %w", sqlmigrate.ErrQueryApplied, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ go 1.26.1
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/microsoft/go-mssqldb v1.9.8
|
github.com/microsoft/go-mssqldb v1.9.8
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.1
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|||||||
@ -32,8 +32,8 @@ 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.1 h1:yhQb4KSwSny1WSC1Y1Z6oHT7V1lznKuj1vzZkF6MqFo=
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2 h1:hcmhYyUFVj/GqyChP+0Ry2WZCHnoruFMbsy+2KVzsfA=
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.1/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
|
||||||
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=
|
||||||
|
|||||||
@ -28,13 +28,13 @@ func New(db *sql.DB) *Migrator {
|
|||||||
var _ sqlmigrate.Migrator = (*Migrator)(nil)
|
var _ sqlmigrate.Migrator = (*Migrator)(nil)
|
||||||
|
|
||||||
// ExecUp runs the up migration SQL inside a transaction.
|
// ExecUp runs the up migration SQL inside a transaction.
|
||||||
func (m *Migrator) ExecUp(ctx context.Context, mig sqlmigrate.Migration) error {
|
func (m *Migrator) ExecUp(ctx context.Context, mig sqlmigrate.Migration, sql string) error {
|
||||||
return m.execInTx(ctx, mig.Up)
|
return m.execInTx(ctx, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecDown runs the down migration SQL inside a transaction.
|
// ExecDown runs the down migration SQL inside a transaction.
|
||||||
func (m *Migrator) ExecDown(ctx context.Context, mig sqlmigrate.Migration) error {
|
func (m *Migrator) ExecDown(ctx context.Context, mig sqlmigrate.Migration, sql string) error {
|
||||||
return m.execInTx(ctx, mig.Down)
|
return m.execInTx(ctx, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Migrator) execInTx(ctx context.Context, sqlStr string) error {
|
func (m *Migrator) execInTx(ctx context.Context, sqlStr string) error {
|
||||||
@ -57,7 +57,7 @@ func (m *Migrator) execInTx(ctx context.Context, sqlStr string) error {
|
|||||||
|
|
||||||
// Applied returns all applied migrations from the _migrations table.
|
// Applied returns all applied migrations from the _migrations table.
|
||||||
// Returns an empty slice if the table does not exist (SQL Server error 208).
|
// Returns an empty slice if the table does not exist (SQL Server error 208).
|
||||||
func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.AppliedMigration, error) {
|
func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.Migration, error) {
|
||||||
rows, err := m.DB.QueryContext(ctx, "SELECT id, name FROM _migrations ORDER BY name")
|
rows, err := m.DB.QueryContext(ctx, "SELECT id, name FROM _migrations ORDER BY name")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// SQL Server error 208: "Invalid object name '_migrations'"
|
// SQL Server error 208: "Invalid object name '_migrations'"
|
||||||
@ -68,9 +68,9 @@ func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.AppliedMigration,
|
|||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
var applied []sqlmigrate.AppliedMigration
|
var applied []sqlmigrate.Migration
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var a sqlmigrate.AppliedMigration
|
var a sqlmigrate.Migration
|
||||||
if err := rows.Scan(&a.ID, &a.Name); err != nil {
|
if err := rows.Scan(&a.ID, &a.Name); err != nil {
|
||||||
return nil, fmt.Errorf("%w: scanning row: %w", sqlmigrate.ErrQueryApplied, err)
|
return nil, fmt.Errorf("%w: scanning row: %w", sqlmigrate.ErrQueryApplied, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ go 1.26.1
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-sql-driver/mysql v1.9.3
|
github.com/go-sql-driver/mysql v1.9.3
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.1
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2
|
||||||
)
|
)
|
||||||
|
|
||||||
require filippo.io/edwards25519 v1.1.0 // indirect
|
require filippo.io/edwards25519 v1.1.0 // indirect
|
||||||
|
|||||||
@ -2,5 +2,5 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
|||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
|
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
|
||||||
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
|
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.1 h1:yhQb4KSwSny1WSC1Y1Z6oHT7V1lznKuj1vzZkF6MqFo=
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2 h1:hcmhYyUFVj/GqyChP+0Ry2WZCHnoruFMbsy+2KVzsfA=
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.1/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
|
||||||
|
|||||||
@ -42,14 +42,14 @@ var _ sqlmigrate.Migrator = (*Migrator)(nil)
|
|||||||
|
|
||||||
// ExecUp runs the up migration SQL in a transaction. DDL statements
|
// ExecUp runs the up migration SQL in a transaction. DDL statements
|
||||||
// (CREATE, ALTER, DROP) are implicitly committed by MySQL; see package docs.
|
// (CREATE, ALTER, DROP) are implicitly committed by MySQL; see package docs.
|
||||||
func (m *Migrator) ExecUp(ctx context.Context, mig sqlmigrate.Migration) error {
|
func (m *Migrator) ExecUp(ctx context.Context, mig sqlmigrate.Migration, sql string) error {
|
||||||
return m.exec(ctx, mig.Up)
|
return m.exec(ctx, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecDown runs the down migration SQL in a transaction. DDL statements
|
// ExecDown runs the down migration SQL in a transaction. DDL statements
|
||||||
// (CREATE, ALTER, DROP) are implicitly committed by MySQL; see package docs.
|
// (CREATE, ALTER, DROP) are implicitly committed by MySQL; see package docs.
|
||||||
func (m *Migrator) ExecDown(ctx context.Context, mig sqlmigrate.Migration) error {
|
func (m *Migrator) ExecDown(ctx context.Context, mig sqlmigrate.Migration, sql string) error {
|
||||||
return m.exec(ctx, mig.Down)
|
return m.exec(ctx, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Migrator) exec(ctx context.Context, sqlStr string) error {
|
func (m *Migrator) exec(ctx context.Context, sqlStr string) error {
|
||||||
@ -84,7 +84,7 @@ func (m *Migrator) exec(ctx context.Context, sqlStr string) error {
|
|||||||
|
|
||||||
// Applied returns all applied migrations from the _migrations table.
|
// Applied returns all applied migrations from the _migrations table.
|
||||||
// Returns an empty slice if the table does not exist (MySQL error 1146).
|
// Returns an empty slice if the table does not exist (MySQL error 1146).
|
||||||
func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.AppliedMigration, error) {
|
func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.Migration, error) {
|
||||||
rows, err := m.DB.QueryContext(ctx, "SELECT id, name FROM _migrations ORDER BY name")
|
rows, err := m.DB.QueryContext(ctx, "SELECT id, name FROM _migrations ORDER BY name")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if mysqlErr, ok := errors.AsType[*mysql.MySQLError](err); ok && mysqlErr.Number == 1146 {
|
if mysqlErr, ok := errors.AsType[*mysql.MySQLError](err); ok && mysqlErr.Number == 1146 {
|
||||||
@ -94,9 +94,9 @@ func (m *Migrator) Applied(ctx context.Context) ([]sqlmigrate.AppliedMigration,
|
|||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
var applied []sqlmigrate.AppliedMigration
|
var applied []sqlmigrate.Migration
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var a sqlmigrate.AppliedMigration
|
var a sqlmigrate.Migration
|
||||||
if err := rows.Scan(&a.ID, &a.Name); err != nil {
|
if err := rows.Scan(&a.ID, &a.Name); err != nil {
|
||||||
return nil, fmt.Errorf("%w: scanning row: %w", sqlmigrate.ErrQueryApplied, err)
|
return nil, fmt.Errorf("%w: scanning row: %w", sqlmigrate.ErrQueryApplied, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ go 1.26.1
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/jackc/pgx/v5 v5.9.1
|
github.com/jackc/pgx/v5 v5.9.1
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.1
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|||||||
@ -16,8 +16,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
|
|||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
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.1 h1:yhQb4KSwSny1WSC1Y1Z6oHT7V1lznKuj1vzZkF6MqFo=
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2 h1:hcmhYyUFVj/GqyChP+0Ry2WZCHnoruFMbsy+2KVzsfA=
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.1/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
|
||||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||||
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||||
|
|||||||
@ -45,13 +45,13 @@ func New(pool *pgxpool.Pool) *Migrator {
|
|||||||
var _ sqlmigrate.Migrator = (*Migrator)(nil)
|
var _ sqlmigrate.Migrator = (*Migrator)(nil)
|
||||||
|
|
||||||
// ExecUp runs the up migration SQL inside a PostgreSQL transaction.
|
// ExecUp runs the up migration SQL inside a PostgreSQL transaction.
|
||||||
func (r *Migrator) ExecUp(ctx context.Context, m sqlmigrate.Migration) error {
|
func (r *Migrator) ExecUp(ctx context.Context, m sqlmigrate.Migration, sql string) error {
|
||||||
return r.execInTx(ctx, m.Up)
|
return r.execInTx(ctx, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecDown runs the down migration SQL inside a PostgreSQL transaction.
|
// ExecDown runs the down migration SQL inside a PostgreSQL transaction.
|
||||||
func (r *Migrator) ExecDown(ctx context.Context, m sqlmigrate.Migration) error {
|
func (r *Migrator) ExecDown(ctx context.Context, m sqlmigrate.Migration, sql string) error {
|
||||||
return r.execInTx(ctx, m.Down)
|
return r.execInTx(ctx, sql)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Migrator) execInTx(ctx context.Context, sql string) error {
|
func (r *Migrator) execInTx(ctx context.Context, sql string) error {
|
||||||
@ -74,7 +74,7 @@ func (r *Migrator) execInTx(ctx context.Context, sql string) error {
|
|||||||
|
|
||||||
// Applied returns all applied migrations from the _migrations table.
|
// Applied returns all applied migrations from the _migrations table.
|
||||||
// Returns an empty slice if the table does not exist (PG error 42P01).
|
// Returns an empty slice if the table does not exist (PG error 42P01).
|
||||||
func (r *Migrator) Applied(ctx context.Context) ([]sqlmigrate.AppliedMigration, error) {
|
func (r *Migrator) Applied(ctx context.Context) ([]sqlmigrate.Migration, error) {
|
||||||
rows, err := r.Pool.Query(ctx, "SELECT id, name FROM _migrations ORDER BY name")
|
rows, err := r.Pool.Query(ctx, "SELECT id, name FROM _migrations ORDER BY name")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if pgErr, ok := errors.AsType[*pgconn.PgError](err); ok && pgErr.Code == "42P01" {
|
if pgErr, ok := errors.AsType[*pgconn.PgError](err); ok && pgErr.Code == "42P01" {
|
||||||
@ -84,9 +84,9 @@ func (r *Migrator) Applied(ctx context.Context) ([]sqlmigrate.AppliedMigration,
|
|||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
var applied []sqlmigrate.AppliedMigration
|
var applied []sqlmigrate.Migration
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var a sqlmigrate.AppliedMigration
|
var a sqlmigrate.Migration
|
||||||
if err := rows.Scan(&a.ID, &a.Name); err != nil {
|
if err := rows.Scan(&a.ID, &a.Name); err != nil {
|
||||||
return nil, fmt.Errorf("%w: scanning row: %w", sqlmigrate.ErrQueryApplied, err)
|
return nil, fmt.Errorf("%w: scanning row: %w", sqlmigrate.ErrQueryApplied, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,4 @@ module github.com/therootcompany/golib/database/sqlmigrate/shmigrate
|
|||||||
|
|
||||||
go 1.26.1
|
go 1.26.1
|
||||||
|
|
||||||
require github.com/therootcompany/golib/database/sqlmigrate v1.0.0
|
require github.com/therootcompany/golib/database/sqlmigrate v1.0.2
|
||||||
|
|
||||||
replace github.com/therootcompany/golib/database/sqlmigrate => ../
|
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.0 h1:vehFGUBdv/su0jDzSNxYN7N7i1KE3l2QJDf4x9LXhwQ=
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2 h1:hcmhYyUFVj/GqyChP+0Ry2WZCHnoruFMbsy+2KVzsfA=
|
||||||
github.com/therootcompany/golib/database/sqlmigrate v1.0.0/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
|
github.com/therootcompany/golib/database/sqlmigrate v1.0.2/go.mod h1:7PQUjwT78Hx+SftcIKI2PH4zSFlrSO0V9h618PJqC38=
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user