Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
barroco committed Dec 5, 2024
1 parent 6ba104f commit 5831bf8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmds/db-manager/migration/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,19 @@ func migrate(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("failed to load SQL content from %s: %e", fullFilePath, err)
}

// Ensure SQL session has implicit transactions disabled for CRDB versions 22.2+
sessionConfigurationSQL := ""
if isCockroach && ds.Version.SemVer.Compare(*semver.New("22.2.0")) >= 0 {
sessionConfigurationSQL = "SET enable_implicit_transaction_for_batch_statements = false;\n"
}

migrationSQL := ""
if isCockroach {
// Ensure SQL session has implicit transactions disabled for CRDB versions 22.2+
sessionConfigurationSQL := ""
if ds.Version.SemVer.Compare(*semver.New("22.2.0")) >= 0 {
sessionConfigurationSQL = "SET enable_implicit_transaction_for_batch_statements = false;\n"
}

migrationSQL = sessionConfigurationSQL + fmt.Sprintf("USE %s;\n", dbName) + string(rawMigrationSQL)
}
if isYugabyte {
// Migrations do not require database switch in opposite to CRDB.
migrationSQL = sessionConfigurationSQL + string(rawMigrationSQL)
migrationSQL = string(rawMigrationSQL)
}

// Execute migration step
Expand Down

0 comments on commit 5831bf8

Please sign in to comment.