Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applied-migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pgxschema
import (
"testing"

"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
)

func TestGetAppliedMigrationsErrorsWhenNoneExist(t *testing.T) {
Expand Down
14 changes: 7 additions & 7 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"strings"
"testing"

"github.com/jackc/pgconn"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/pashagolub/pgxmock"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/pashagolub/pgxmock/v4"
)

// BadQueryer implements the Queryer interface, but fails on every call to
Expand All @@ -19,7 +19,7 @@ import (
type BadQueryer struct{}

func (bq BadQueryer) Exec(_ context.Context, sql string, _ ...interface{}) (pgconn.CommandTag, error) {
return []byte{}, fmt.Errorf("FAIL: %s", strings.TrimSpace(sql))
return pgconn.CommandTag{}, fmt.Errorf("FAIL: %s", strings.TrimSpace(sql))
}

func (bq BadQueryer) Query(_ context.Context, sql string, _ ...interface{}) (pgx.Rows, error) {
Expand Down Expand Up @@ -50,7 +50,7 @@ func TestApplyBeginFailure(t *testing.T) {
if err != nil {
t.Error(err)
}
mock.ExpectExec("^SELECT pg_advisory_lock").WillReturnResult(pgconn.CommandTag{})
mock.ExpectExec("^SELECT pg_advisory_lock").WillReturnResult(pgconn.NewCommandTag("SELECT 1"))
mock.ExpectBegin().WillReturnError(fmt.Errorf("Begin Failed"))
migrator := NewMigrator()
err = migrator.Apply(mock, testMigrations(t, "useless-ansi"))
Expand All @@ -72,7 +72,7 @@ func TestApplyCreateMigrationsTableFailure(t *testing.T) {
if err != nil {
t.Error(err)
}
mock.ExpectExec("^SELECT pg_advisory_lock").WillReturnResult(pgconn.CommandTag{})
mock.ExpectExec("^SELECT pg_advisory_lock").WillReturnResult(pgconn.NewCommandTag("SELECT 1"))
mock.ExpectBegin()
mock.ExpectQuery("^CREATE TABLE").WillReturnError(fmt.Errorf("Create Migrations Table Failed"))
err = NewMigrator().Apply(mock, testMigrations(t, "useless-ansi"))
Expand Down
13 changes: 4 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module github.com/adlio/pgxschema
go 1.25.0

require (
github.com/jackc/pgconn v1.14.3
github.com/jackc/pgx/v4 v4.18.3
github.com/jackc/pgx/v5 v5.10.0
github.com/ory/dockertest/v3 v3.12.0
github.com/pashagolub/pgxmock v1.8.0
github.com/pashagolub/pgxmock/v4 v4.9.0
)

require (
Expand All @@ -28,13 +27,9 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgtype v1.14.4 // indirect
github.com/jackc/puddle v1.3.0 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/moby/api v1.54.2 // indirect
github.com/moby/moby/client v0.4.1 // indirect
Expand All @@ -53,7 +48,7 @@ require (
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/otel/trace v1.43.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.52.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/text v0.37.0 // indirect
)
207 changes: 8 additions & 199 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"
"testing"

"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/ory/dockertest/v3"
)

Expand Down Expand Up @@ -72,7 +72,7 @@ func connectDB(t *testing.T, name string) *pgxpool.Pool {
if !exists {
t.Errorf("Database '%s' doesn't exist.", name)
}
db, err := pgxpool.Connect(context.Background(), info.DSN())
db, err := pgxpool.New(context.Background(), info.DSN())
if err != nil {
t.Fatalf("Failed to connect to %s: %s", name, err)
}
Expand Down
2 changes: 1 addition & 1 deletion migrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
)

// TestCreateMigrationsTable ensures that each test datbase can
Expand Down
4 changes: 2 additions & 2 deletions pgxschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package pgxschema
import (
"context"

"github.com/jackc/pgconn"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
)

// Connection defines the interface for either a *pgxpool.Pool or a *pgx.Conn,
Expand Down
4 changes: 2 additions & 2 deletions pgxschema_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pgxschema

import (
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
)

// Interface verification that pgx.Conn and pgxpool.Pool both satisfy our
Expand Down
6 changes: 3 additions & 3 deletions testdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"log"
"testing"

"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
)
Expand Down Expand Up @@ -101,7 +101,7 @@ func (c *TestDB) Init(pool *dockertest.Pool) {
// Connect creates an additional *pgxpool.Pool connection for a particular
// test database.
func (c *TestDB) Connect(t *testing.T) *pgxpool.Pool {
db, err := pgxpool.Connect(context.Background(), c.DSN())
db, err := pgxpool.New(context.Background(), c.DSN())
if err != nil {
t.Error(err)
}
Expand Down
Loading