Skip to content
This repository was archived by the owner on Jun 28, 2018. It is now read-only.

Commit 2c0f4f5

Browse files
committed
Update cockroachDB Txn signatures
cockroach-go made a backwards-incompatible change to their transaction function signatures, which was causing the cockroach instrumentation to fail. Updates the signature to match the cockraoch-go change.
1 parent 8b5365e commit 2c0f4f5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

database/cockroachdb/cockroachdb.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/mattes/migrate/database"
1414
"regexp"
1515
"strconv"
16+
"context"
1617
)
1718

1819
func init() {
@@ -142,7 +143,7 @@ func (c *CockroachDb) Close() error {
142143
// Locking is done manually with a separate lock table. Implementing advisory locks in CRDB is being discussed
143144
// See: https://github.com/cockroachdb/cockroach/issues/13546
144145
func (c *CockroachDb) Lock() error {
145-
err := crdb.ExecuteTx(c.db, func(tx *sql.Tx) error {
146+
err := crdb.ExecuteTx(context.Background(), c.db, nil, func(tx *sql.Tx) error {
146147
aid, err := database.GenerateAdvisoryLockId(c.config.DatabaseName)
147148
if err != nil {
148149
return err
@@ -221,7 +222,7 @@ func (c *CockroachDb) Run(migration io.Reader) error {
221222
}
222223

223224
func (c *CockroachDb) SetVersion(version int, dirty bool) error {
224-
return crdb.ExecuteTx(c.db, func(tx *sql.Tx) error {
225+
return crdb.ExecuteTx(context.Background(), c.db, nil, func(tx *sql.Tx) error {
225226
if _, err := tx.Exec( `TRUNCATE "` + c.config.MigrationsTable + `"`); err != nil {
226227
return err
227228
}

0 commit comments

Comments
 (0)