Skip to content

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

fix: distinguish between no default and default null (#7165)

rebeliceea99fc8e1fd3
diff --git a/backend/api/v1/schema_design_service.go b/backend/api/v1/schema_design_service.go
index f887b404b0..749df34b72 100644
--- a/backend/api/v1/schema_design_service.go
+++ b/backend/api/v1/schema_design_service.go
@@ -790,10 +790,6 @@ func (c *columnState) toString(buf *strings.Builder) error {
if _, err := buf.WriteString(fmt.Sprintf(" DEFAULT %s", *c.defaultValue)); err != nil {
return err
}
- } else {
- if _, err := buf.WriteString(" DEFAULT NULL"); err != nil {
- return err
- }
}
if c.comment != "" {
if _, err := buf.WriteString(fmt.Sprintf(" COMMENT '%s'", c.comment)); err != nil {
diff --git a/backend/api/v1/testdata/design.yaml b/backend/api/v1/testdata/design.yaml
index 3a0735857a..9d9602f3fe 100644
--- a/backend/api/v1/testdata/design.yaml
+++ b/backend/api/v1/testdata/design.yaml
@@ -159,12 +159,12 @@
`a` varchar(10) NOT NULL DEFAULT 'default value' COMMENT 'this is comment, aha',
`c` int NOT NULL,
`e` int NULL,
- `b` char(10) NOT NULL DEFAULT NULL,
+ `b` char(10) NOT NULL,
PRIMARY KEY (`a`, `b`, `c`),
CONSTRAINT `fk1` FOREIGN KEY (`b`) REFERENCES `t2` (`b`)
);
CREATE TABLE `t2` (
- `b` int NULL DEFAULT NULL,
+ `b` int NULL,
PRIMARY KEY (`b`),
CONSTRAINT `fk1` FOREIGN KEY (`b`) REFERENCES `t4` (`b`)
);