Skip to content

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

fix(branch): add comment of primary key (#10223)

h3n4l17841073d987
diff --git a/backend/plugin/schema/mysql/state.go b/backend/plugin/schema/mysql/state.go
index 416abe5076..52f5d67fd7 100644
--- a/backend/plugin/schema/mysql/state.go
+++ b/backend/plugin/schema/mysql/state.go
@@ -439,11 +439,11 @@ func (i *indexState) toString(buf *strings.Builder) error {
return err
}
}
+ }
- if i.comment != "" {
- if _, err := buf.WriteString(fmt.Sprintf(" COMMENT '%s'", i.comment)); err != nil {
- return err
- }
+ if i.comment != "" {
+ if _, err := buf.WriteString(fmt.Sprintf(" COMMENT '%s'", i.comment)); err != nil {
+ return err
}
}
return nil
diff --git a/backend/plugin/schema/mysql/testdata/get_design_schema.yaml b/backend/plugin/schema/mysql/testdata/get_design_schema.yaml
index 2c5950d813..29ec038669 100644
--- a/backend/plugin/schema/mysql/testdata/get_design_schema.yaml
+++ b/backend/plugin/schema/mysql/testdata/get_design_schema.yaml
@@ -75,7 +75,8 @@
],
"unique": true,
"primary": true,
- "visible": true
+ "visible": true,
+ "comment": "primary key of multiple key fields"
}
],
"foreignKeys": [
@@ -224,7 +225,7 @@
`c` int NOT NULL AUTO_INCREMENT,
`e` int NULL,
`b` char(10) NOT NULL,
- PRIMARY KEY (`a`, `b`, `c`),
+ PRIMARY KEY (`a`, `b`, `c`) COMMENT 'primary key of multiple key fields',
CONSTRAINT `fk1` FOREIGN KEY (`b`) REFERENCES `t2` (`b`)
);