Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(mongodb): convert string to long and then pass to migration_history id (#4299)
h3n4l01a5a0f59fae
diff --git a/plugin/db/mongodb/migrate.go b/plugin/db/mongodb/migrate.goindex 06c40d0bd2..45853f807a 100644--- a/plugin/db/mongodb/migrate.go+++ b/plugin/db/mongodb/migrate.go@@ -4,6 +4,7 @@ import ("context""database/sql""fmt"+ "strconv""time"// embed will embeds the migration schema.@@ -350,8 +351,13 @@ func (driver *Driver) InsertPendingHistory(ctx context.Context, _ *sql.Tx, seque// UpdateHistoryAsDone will update the migration record as done.func (driver *Driver) UpdateHistoryAsDone(ctx context.Context, _ *sql.Tx, migrationDurationNs int64, _ string, insertedID string) error {collection := driver.client.Database(migrationHistoryDefaultDatabase).Collection(migrationHistoryDefaultCollection)+ longMigrationHistoryID, err := strconv.ParseInt(insertedID, 10, 64)+ if err != nil {+ return errors.Wrapf(err, "failed to parse inserted ID %s to int64", insertedID)+ }+filter := bson.M{- "id": insertedID,+ "id": longMigrationHistoryID,}update := bson.M{"$set": bson.M{@@ -373,8 +379,12 @@ func (driver *Driver) UpdateHistoryAsDone(ctx context.Context, _ *sql.Tx, migrat// UpdateHistoryAsFailed will update the migration record as failed.func (driver *Driver) UpdateHistoryAsFailed(ctx context.Context, _ *sql.Tx, migrationDurationNs int64, insertedID string) error {collection := driver.client.Database(migrationHistoryDefaultDatabase).Collection(migrationHistoryDefaultCollection)+ longMigrationHistoryID, err := strconv.ParseInt(insertedID, 10, 64)+ if err != nil {+ return errors.Wrapf(err, "failed to parse inserted ID %s to int64", insertedID)+ }filter := bson.M{- "id": insertedID,+ "id": longMigrationHistoryID,}update := bson.M{"$set": bson.M{