diff --git a/backends/postgres/postgres_backend.go b/backends/postgres/postgres_backend.go index 67c290e..8943f2f 100644 --- a/backends/postgres/postgres_backend.go +++ b/backends/postgres/postgres_backend.go @@ -105,7 +105,10 @@ type PgBackend struct { // # Example URL // // postgres://worker:secret@workerdb.example.com:5432/mydb?sslmode=verify-ca&pool_max_conns=10 -func Backend(ctx context.Context, opts ...config.Option) (pb types.Backend, err error) { +func Backend(ctx context.Context, opts ...neoq.ConfigOption) (pb neoq.Neoq, err error) { + cfg := neoq.NewConfig() + cfg.IdleTransactionTimeout = neoq.DefaultIdleTxTimeout + p := &PgBackend{ mu: &sync.RWMutex{}, config: config.New(), @@ -198,7 +201,7 @@ func txFromContext(ctx context.Context) (t pgx.Tx, err error) { // //nolint:funlen,gocyclo,cyclop func (p *PgBackend) initializeDB() (err error) { - d, err := iofs.New(migrationsFS, "migrations") + migrations, err := iofs.New(migrationsFS, "migrations") if err != nil { p.logger.Error("unable to run migrations", "error", err) return @@ -221,13 +224,13 @@ func (p *PgBackend) initializeDB() (err error) { sslMode = "disable" } - pqConnectionString := fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=%s", + pqConnectionString := fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=%s&x-migrations-table=neoq_schema_migrations", pgxCfg.User, pgxCfg.Password, pgxCfg.Host, pgxCfg.Database, sslMode) - m, err := migrate.NewWithSourceInstance("iofs", d, pqConnectionString) + m, err := migrate.NewWithSourceInstance("iofs", migrations, pqConnectionString) if err != nil { p.logger.Error("unable to run migrations", "error", err) return