Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: use pointer receiver (#4097)

p0nya10696200d8d
diff --git a/plugin/db/pg/migrate.go b/plugin/db/pg/migrate.go
index 8425a6f5fd..bb9db3aaba 100644
--- a/plugin/db/pg/migrate.go
+++ b/plugin/db/pg/migrate.go
@@ -115,7 +115,7 @@ func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error {
}
// FindLargestVersionSinceBaseline will find the largest version since last baseline or branch.
-func (driver Driver) FindLargestVersionSinceBaseline(ctx context.Context, tx *sql.Tx, namespace string) (*string, error) {
+func (driver *Driver) FindLargestVersionSinceBaseline(ctx context.Context, tx *sql.Tx, namespace string) (*string, error) {
largestBaselineSequence, err := driver.FindLargestSequence(ctx, tx, namespace, true /* baseline */)
if err != nil {
return nil, err
@@ -140,7 +140,7 @@ func (driver Driver) FindLargestVersionSinceBaseline(ctx context.Context, tx *sq
}
// FindLargestSequence will return the largest sequence number.
-func (Driver) FindLargestSequence(ctx context.Context, tx *sql.Tx, namespace string, baseline bool) (int, error) {
+func (*Driver) FindLargestSequence(ctx context.Context, tx *sql.Tx, namespace string, baseline bool) (int, error) {
findLargestSequenceQuery := `
SELECT MAX(sequence) FROM migration_history
WHERE namespace = $1`
@@ -164,7 +164,7 @@ func (Driver) FindLargestSequence(ctx context.Context, tx *sql.Tx, namespace str
}
// InsertPendingHistory will insert the migration record with pending status and return the inserted ID.
-func (Driver) InsertPendingHistory(ctx context.Context, tx *sql.Tx, sequence int, prevSchema string, m *db.MigrationInfo, storedVersion, statement string) (int64, error) {
+func (*Driver) InsertPendingHistory(ctx context.Context, tx *sql.Tx, sequence int, prevSchema string, m *db.MigrationInfo, storedVersion, statement string) (int64, error) {
const insertHistoryQuery = `
INSERT INTO migration_history (
created_by,
@@ -213,7 +213,7 @@ func (Driver) InsertPendingHistory(ctx context.Context, tx *sql.Tx, sequence int
}
// UpdateHistoryAsDone will update the migration record as done.
-func (Driver) UpdateHistoryAsDone(ctx context.Context, tx *sql.Tx, migrationDurationNs int64, updatedSchema string, insertedID int64) error {
+func (*Driver) UpdateHistoryAsDone(ctx context.Context, tx *sql.Tx, migrationDurationNs int64, updatedSchema string, insertedID int64) error {
const updateHistoryAsDoneQuery = `
UPDATE
migration_history
@@ -228,7 +228,7 @@ func (Driver) UpdateHistoryAsDone(ctx context.Context, tx *sql.Tx, migrationDura
}
// UpdateHistoryAsFailed will update the migration record as failed.
-func (Driver) UpdateHistoryAsFailed(ctx context.Context, tx *sql.Tx, migrationDurationNs int64, insertedID int64) error {
+func (*Driver) UpdateHistoryAsFailed(ctx context.Context, tx *sql.Tx, migrationDurationNs int64, insertedID int64) error {
const updateHistoryAsFailedQuery = `
UPDATE
migration_history
diff --git a/plugin/db/pg/pg.go b/plugin/db/pg/pg.go
index bd0aeecdbb..fbf64738e1 100644
--- a/plugin/db/pg/pg.go
+++ b/plugin/db/pg/pg.go
@@ -70,7 +70,7 @@ func newDriver(config db.DriverConfig) db.Driver {
// Open opens a Postgres driver.
func (driver *Driver) Open(_ context.Context, _ db.Type, config db.ConnectionConfig, connCtx db.ConnectionContext) (db.Driver, error) {
- // Require username for Postgres, as the guessDSN 1st guesss is to use the username as the connecting database
+ // Require username for Postgres, as the guessDSN 1st guess is to use the username as the connecting database
// if database name is not explicitly specified.
if config.Username == "" {
return nil, errors.Errorf("user must be set")