diff --git a/database/pgx/pgx.go b/database/pgx/pgx.go index 33e96292e..b746f0604 100644 --- a/database/pgx/pgx.go +++ b/database/pgx/pgx.go @@ -370,7 +370,7 @@ func (p *Postgres) releaseTableLock() error { } query := "DELETE FROM " + pq.QuoteIdentifier(p.config.LockTable) + " WHERE lock_id = $1" - if _, err := p.db.Exec(query, aid); err != nil { + if _, err := p.conn.ExecContext(context.Background(), query, aid); err != nil { return database.Error{OrigErr: err, Err: "failed to release migration lock", Query: []byte(query)} } @@ -615,7 +615,7 @@ func (p *Postgres) ensureLockTable() error { var count int query := `SELECT COUNT(1) FROM information_schema.tables WHERE table_name = $1 AND table_schema = (SELECT current_schema()) LIMIT 1` - if err := p.db.QueryRow(query, p.config.LockTable).Scan(&count); err != nil { + if err := p.conn.QueryRowContext(context.Background(), query, p.config.LockTable).Scan(&count); err != nil { return &database.Error{OrigErr: err, Query: []byte(query)} } if count == 1 { @@ -623,7 +623,7 @@ func (p *Postgres) ensureLockTable() error { } query = `CREATE TABLE ` + pq.QuoteIdentifier(p.config.LockTable) + ` (lock_id BIGINT NOT NULL PRIMARY KEY)` - if _, err := p.db.Exec(query); err != nil { + if _, err := p.conn.ExecContext(context.Background(), query); err != nil { return &database.Error{OrigErr: err, Query: []byte(query)} }