Skip to content

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

fix(test): stable order (#11112)

p0ny143a0f483941
diff --git a/backend/plugin/advisor/mysql/advisor_statement_disallow_mix_dml.go b/backend/plugin/advisor/mysql/advisor_statement_disallow_mix_dml.go
index a39330333b..eec36ed436 100644
--- a/backend/plugin/advisor/mysql/advisor_statement_disallow_mix_dml.go
+++ b/backend/plugin/advisor/mysql/advisor_statement_disallow_mix_dml.go
@@ -50,8 +50,11 @@ func (*StatementDisallowMixDMLAdvisor) Check(ctx advisor.Context, _ string) ([]a
for table, dmlCount := range checker.dmlStatementCount {
if len(dmlCount) > 1 {
content := "Found"
- for t, count := range dmlCount {
- content += fmt.Sprintf(" %d %s,", count, t)
+ for _, t := range []string{"DELETE", "INSERT", "UPDATE"} {
+ count, ok := dmlCount[t]
+ if ok {
+ content += fmt.Sprintf(" %d %s,", count, t)
+ }
}
content = strings.TrimSuffix(content, ",")
content += fmt.Sprintf(" on table `%s`.`%s`, disallow mixing different types of DML statements", table.database, table.table)
diff --git a/backend/plugin/advisor/mysql/test/statement_disallow_mix_dml.yaml b/backend/plugin/advisor/mysql/test/statement_disallow_mix_dml.yaml
index f94c27ba98..a082d839de 100644
--- a/backend/plugin/advisor/mysql/test/statement_disallow_mix_dml.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_disallow_mix_dml.yaml
@@ -21,7 +21,7 @@
- status: WARN
code: 227
title: statement.disallow-mix-dml
- content: Found 1 UPDATE, 1 DELETE on table ``.`tech_book`, disallow mixing different types of DML statements
+ content: Found 1 DELETE, 1 UPDATE on table ``.`tech_book`, disallow mixing different types of DML statements
line: 0
column: 0
details: ""