Skip to content

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

Do not execute migration statement if it's empty

天舟8b6086e91c63
diff --git a/db/mysql.go b/db/mysql.go
index b1cee60be1..60989e36d3 100644
--- a/db/mysql.go
+++ b/db/mysql.go
@@ -493,8 +493,10 @@ func (driver *MySQLDriver) ExecuteMigration(ctx context.Context, m *MigrationInf
return err
}
- // Phase 2 - Executing migration unless it's VCS baselining
- if m.Engine != VCS || m.Type != Baseline {
+ // Phase 2 - Executing migration
+ // Branch migration type always has empty sql.
+ // Baseline migration type could also has empty sql when the database is newly created.
+ if statement != "" {
_, err = tx.ExecContext(ctx, statement)
if err != nil {
return formatError(err)