Skip to content

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

chore: add \n in getMySQLDesignSchema (#8443)

h3n4lcd336c064a3f
diff --git a/backend/api/v1/schema_design_transformer.go b/backend/api/v1/schema_design_transformer.go
index 7b42e3e391..7ea911e67d 100644
--- a/backend/api/v1/schema_design_transformer.go
+++ b/backend/api/v1/schema_design_transformer.go
@@ -750,6 +750,13 @@ func getMySQLDesignSchema(baselineSchema string, to *v1pb.DatabaseMetadata) (str
}
}
+ // The last statement of the result is SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
+ // We should append a 0xa to the end of the result to avoid the extra newline diff.
+ // TODO(rebelice/zp): find a more elegant way to do this.
+ if err := listener.result.WriteByte('\n'); err != nil {
+ return "", err
+ }
+
return listener.result.String(), nil
}
diff --git a/backend/api/v1/testdata/design.yaml b/backend/api/v1/testdata/design.yaml
index 30f46b3a1f..321e956b74 100644
--- a/backend/api/v1/testdata/design.yaml
+++ b/backend/api/v1/testdata/design.yaml
@@ -33,6 +33,7 @@
comment: ""
classification: ""
usercomment: ""
+ effectivemaskinglevel: 0
indexes: []
engine: ""
collation: ""
@@ -58,6 +59,7 @@
comment: this is comment, aha
classification: ""
usercomment: ""
+ effectivemaskinglevel: 0
- name: b
position: 0
default: null
@@ -68,6 +70,7 @@
comment: ""
classification: ""
usercomment: ""
+ effectivemaskinglevel: 0
- name: c
position: 0
default: null
@@ -78,6 +81,7 @@
comment: ""
classification: ""
usercomment: ""
+ effectivemaskinglevel: 0
- name: e
position: 0
default: null
@@ -88,6 +92,7 @@
comment: ""
classification: ""
usercomment: ""
+ effectivemaskinglevel: 0
indexes:
- name: PRIMARY
expressions:
@@ -132,6 +137,7 @@
comment: ""
classification: ""
usercomment: ""
+ effectivemaskinglevel: 0
- name: a
position: 0
default: null
@@ -142,6 +148,7 @@
comment: ""
classification: ""
usercomment: ""
+ effectivemaskinglevel: 0
indexes:
- name: PRIMARY
expressions:
@@ -179,7 +186,7 @@
characterset: ""
collation: ""
extensions: []
- result: |
+ result: |+
CREATE TABLE `t` (
`a` int NOT NULL
);
@@ -198,3 +205,4 @@
PRIMARY KEY (`b`),
CONSTRAINT `fk1` FOREIGN KEY (`b`) REFERENCES `t4` (`b`)
);
+