Skip to content

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

fix: fix the table announcement for MySQL (#10990)

h3n4l94c4585ff612
diff --git a/backend/plugin/schema/mysql/get_design_schema.go b/backend/plugin/schema/mysql/get_design_schema.go
index 41be02b757..5d9c42aa59 100644
--- a/backend/plugin/schema/mysql/get_design_schema.go
+++ b/backend/plugin/schema/mysql/get_design_schema.go
@@ -1046,7 +1046,7 @@ func writeRemainingTables(w io.StringWriter, to *storepb.DatabaseSchemaMetadata,
}
func getTableAnnouncement(name string) string {
- return fmt.Sprintf("\n--\n-- Table structure for table `%s`\n--\n", name)
+ return fmt.Sprintf("\n--\n-- Table structure for `%s`\n--\n", name)
}
// getDataTypePlainText returns the plain text of the data type,
diff --git a/backend/plugin/schema/mysql/testdata/get_design_schema.yaml b/backend/plugin/schema/mysql/testdata/get_design_schema.yaml
index e428ae5e21..173cd7ac7f 100644
--- a/backend/plugin/schema/mysql/testdata/get_design_schema.yaml
+++ b/backend/plugin/schema/mysql/testdata/get_design_schema.yaml
@@ -111,7 +111,7 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
--
- -- Table structure for table `wahaha`
+ -- Table structure for `wahaha`
--
CREATE TABLE `wahaha` (
`id` int NOT NULL,
@@ -523,7 +523,7 @@
);
--
- -- Table structure for table `t2`
+ -- Table structure for `t2`
--
CREATE TABLE `t2` (
`b` int,
@@ -533,7 +533,7 @@
);
--
- -- Table structure for table `t5`
+ -- Table structure for `t5`
--
CREATE TABLE `t5` (
`a` int NOT NULL COMMENT 'this is comment',
diff --git a/backend/plugin/schema/mysql/testdata/parse_to_metadata.yaml b/backend/plugin/schema/mysql/testdata/parse_to_metadata.yaml
index f70b87871c..5571e1cd2c 100644
--- a/backend/plugin/schema/mysql/testdata/parse_to_metadata.yaml
+++ b/backend/plugin/schema/mysql/testdata/parse_to_metadata.yaml
@@ -19,152 +19,152 @@
) ENGINE=InnoDB COLLATE=utf8mb4_0900_ai_ci COMMENT 'this is comment with '' escaped';
metadata: |-
{
- "schemas": [
+ "schemas": [
{
- "tables": [
+ "tables": [
{
- "name": "t",
- "columns": [
+ "name": "t",
+ "columns": [
{
- "name": "a",
- "position": 1,
- "type": "int",
- "comment": "this is comment"
+ "name": "a",
+ "position": 1,
+ "type": "int",
+ "comment": "this is comment"
},
{
- "name": "b",
- "position": 2,
- "type": "VARCHAR(20)"
+ "name": "b",
+ "position": 2,
+ "type": "VARCHAR(20)"
},
{
- "name": "c",
- "position": 3,
- "type": "int"
+ "name": "c",
+ "position": 3,
+ "type": "int"
},
{
- "name": "d",
- "position": 4,
- "defaultNull": true,
- "nullable": true,
- "type": "text"
+ "name": "d",
+ "position": 4,
+ "defaultNull": true,
+ "nullable": true,
+ "type": "text"
},
{
- "name": "t_not_null",
- "position": 5,
- "type": "text"
+ "name": "t_not_null",
+ "position": 5,
+ "type": "text"
},
{
- "name": "e",
- "position": 6,
- "type": "varchar(20)"
+ "name": "e",
+ "position": 6,
+ "type": "varchar(20)"
},
{
- "name": "g",
- "position": 7,
- "defaultExpression": "CURRENT_TIMESTAMP",
- "onUpdate": "CURRENT_TIMESTAMP",
- "type": "TIMESTAMP"
+ "name": "g",
+ "position": 7,
+ "defaultExpression": "CURRENT_TIMESTAMP",
+ "onUpdate": "CURRENT_TIMESTAMP",
+ "type": "TIMESTAMP"
}
],
- "indexes": [
+ "indexes": [
{
- "name": "PRIMARY",
- "expressions": [
+ "name": "PRIMARY",
+ "expressions": [
"a"
],
- "keyLength": [
+ "keyLength": [
"-1"
],
- "unique": true,
- "primary": true,
- "visible": true
+ "unique": true,
+ "primary": true,
+ "visible": true
},
{
- "name": "t_c_uniq_idx",
- "expressions": [
+ "name": "t_c_uniq_idx",
+ "expressions": [
"c"
],
- "keyLength": [
+ "keyLength": [
"-1"
],
- "type": "BTREE",
- "unique": true,
- "visible": true
+ "type": "BTREE",
+ "unique": true,
+ "visible": true
},
{
- "name": "t_c_plus_5_uniq_idx",
- "expressions": [
+ "name": "t_c_plus_5_uniq_idx",
+ "expressions": [
"((`c` + 5))"
],
- "keyLength": [
+ "keyLength": [
"-1"
],
- "type": "BTREE",
- "unique": true,
- "visible": true
+ "type": "BTREE",
+ "unique": true,
+ "visible": true
},
{
- "name": "t_c_plus_5_t_c_plus_3_uniq_idx",
- "expressions": [
+ "name": "t_c_plus_5_t_c_plus_3_uniq_idx",
+ "expressions": [
"((`c` + 5))",
"((`c` + 3))"
],
- "keyLength": [
+ "keyLength": [
"-1",
"-1"
],
- "type": "BTREE",
- "unique": true,
- "visible": true
+ "type": "BTREE",
+ "unique": true,
+ "visible": true
},
{
- "name": "idx_c",
- "expressions": [
+ "name": "idx_c",
+ "expressions": [
"c"
],
- "keyLength": [
+ "keyLength": [
"-1"
],
- "type": "BTREE",
- "visible": true
+ "type": "BTREE",
+ "visible": true
},
{
- "name": "idx_d",
- "expressions": [
+ "name": "idx_d",
+ "expressions": [
"d"
],
- "keyLength": [
+ "keyLength": [
"10"
],
- "type": "BTREE",
- "visible": true
+ "type": "BTREE",
+ "visible": true
},
{
- "name": "idx_e",
- "expressions": [
+ "name": "idx_e",
+ "expressions": [
"e"
],
- "keyLength": [
+ "keyLength": [
"10"
],
- "type": "BTREE",
- "visible": true
+ "type": "BTREE",
+ "visible": true
},
{
- "name": "t_d_fulltext_idx",
- "expressions": [
+ "name": "t_d_fulltext_idx",
+ "expressions": [
"d"
],
- "keyLength": [
+ "keyLength": [
"-1"
],
- "type": "FULLTEXT",
- "visible": true
+ "type": "FULLTEXT",
+ "visible": true
}
],
- "engine": "InnoDB",
- "collation": "utf8mb4_0900_ai_ci",
- "comment": "this is comment with ' escaped"
+ "engine": "InnoDB",
+ "collation": "utf8mb4_0900_ai_ci",
+ "comment": "this is comment with ' escaped"
}
]
}
@@ -182,87 +182,87 @@
create table t2(b int NOT NULL default NULL, primary key (b));
metadata: |-
{
- "schemas": [
+ "schemas": [
{
- "tables": [
+ "tables": [
{
- "name": "t",
- "columns": [
+ "name": "t",
+ "columns": [
{
- "name": "c",
- "position": 1,
- "defaultExpression": "AUTO_INCREMENT",
- "nullable": true,
- "type": "int"
+ "name": "c",
+ "position": 1,
+ "defaultExpression": "AUTO_INCREMENT",
+ "nullable": true,
+ "type": "int"
},
{
- "name": "a",
- "position": 2,
- "defaultExpression": "1",
- "nullable": true,
- "type": "int",
- "comment": "abcdefg"
+ "name": "a",
+ "position": 2,
+ "defaultExpression": "1",
+ "nullable": true,
+ "type": "int",
+ "comment": "abcdefg"
},
{
- "name": "b",
- "position": 3,
- "defaultNull": true,
- "nullable": true,
- "type": "varchar(20)"
+ "name": "b",
+ "position": 3,
+ "defaultNull": true,
+ "nullable": true,
+ "type": "varchar(20)"
}
],
- "indexes": [
+ "indexes": [
{
- "name": "PRIMARY",
- "expressions": [
+ "name": "PRIMARY",
+ "expressions": [
"a",
"b"
],
- "keyLength": [
+ "keyLength": [
"-1",
"-1"
],
- "unique": true,
- "primary": true,
- "visible": true
+ "unique": true,
+ "primary": true,
+ "visible": true
}
],
- "comment": "this is comment with ' escaped",
- "foreignKeys": [
+ "comment": "this is comment with ' escaped",
+ "foreignKeys": [
{
- "name": "fk1",
- "columns": [
+ "name": "fk1",
+ "columns": [
"a"
],
- "referencedTable": "t2",
- "referencedColumns": [
+ "referencedTable": "t2",
+ "referencedColumns": [
"b"
]
}
]
},
{
- "name": "t2",
- "columns": [
+ "name": "t2",
+ "columns": [
{
- "name": "b",
- "position": 1,
- "defaultNull": true,
- "type": "int"
+ "name": "b",
+ "position": 1,
+ "defaultNull": true,
+ "type": "int"
}
],
- "indexes": [
+ "indexes": [
{
- "name": "PRIMARY",
- "expressions": [
+ "name": "PRIMARY",
+ "expressions": [
"b"
],
- "keyLength": [
+ "keyLength": [
"-1"
],
- "unique": true,
- "primary": true,
- "visible": true
+ "unique": true,
+ "primary": true,
+ "visible": true
}
]
}