Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: split walkthrough between mysql and tidb (#9505)
zll60060231e48413d
diff --git a/backend/plugin/advisor/catalog/test/mysql_walk_through_for_incomplete.yaml b/backend/plugin/advisor/catalog/test/mysql_walk_through_for_incomplete.yamlindex 391284b791..43372ba4a3 100644--- a/backend/plugin/advisor/catalog/test/mysql_walk_through_for_incomplete.yaml+++ b/backend/plugin/advisor/catalog/test/mysql_walk_through_for_incomplete.yaml@@ -160,26 +160,26 @@"name": "a","position": 1,"default": "1",- "type": "int(11)"+ "type": "int"},{"name": "b","position": 2,- "type": "varchar(200)",+ "type": "varchar","characterSet": "utf8mb4"},{"name": "c","position": 3,"nullable": true,- "type": "int(11)",+ "type": "int","comment": "This is a comment"},{"name": "d","position": 4,"nullable": true,- "type": "varchar(10)",+ "type": "varchar","collation": "utf8mb4_polish_ci"}],diff --git a/backend/plugin/advisor/catalog/test/mysql_walk_through.yaml b/backend/plugin/advisor/catalog/test/tidb_walk_through.yamlsimilarity index 100%rename from backend/plugin/advisor/catalog/test/mysql_walk_through.yamlrename to backend/plugin/advisor/catalog/test/tidb_walk_through.yamldiff --git a/backend/plugin/advisor/catalog/walk_through.go b/backend/plugin/advisor/catalog/walk_through.goindex 7d128fe335..4789b5cca2 100644--- a/backend/plugin/advisor/catalog/walk_through.go+++ b/backend/plugin/advisor/catalog/walk_through.go@@ -208,8 +208,11 @@ func (e *WalkThroughError) Error() string {// WalkThrough will collect the catalog schema in the databaseState as it walks through the stmt.func (d *DatabaseState) WalkThrough(stmt string) error {switch d.dbType {- case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:- err := d.mysqlWalkThrough(stmt)+ case storepb.Engine_TIDB:+ err := d.tidbWalkThrough(stmt)+ return err+ case storepb.Engine_MYSQL, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:+ err := d.mysqlV2WalkThrough(stmt)return errcase storepb.Engine_POSTGRES:if err := d.pgWalkThrough(stmt); err != nil {@@ -222,10 +225,6 @@ func (d *DatabaseState) WalkThrough(stmt string) error {d.usable = false}return nil- // only for mysqlv2 test.- case storepb.Engine_ENGINE_UNSPECIFIED:- err := d.mysqlV2WalkThrough(stmt)- return errdefault:return &WalkThroughError{Type: ErrorTypeUnsupported,@@ -234,7 +233,7 @@ func (d *DatabaseState) WalkThrough(stmt string) error {}}-func (d *DatabaseState) mysqlWalkThrough(stmt string) error {+func (d *DatabaseState) tidbWalkThrough(stmt string) error {// We define the Catalog as Database -> Schema -> Table. The Schema is only for PostgreSQL.// So we use a Schema whose name is empty for other engines, such as MySQL.// If there is no empty-string-name schema, create it to avoid corner cases.diff --git a/backend/plugin/advisor/catalog/walk_through_test.go b/backend/plugin/advisor/catalog/walk_through_test.goindex f0605993e6..94bafdf98e 100644--- a/backend/plugin/advisor/catalog/walk_through_test.go+++ b/backend/plugin/advisor/catalog/walk_through_test.go@@ -28,17 +28,17 @@ type testData struct {Err *WalkThroughError}-func TestMySQLWalkThrough(t *testing.T) {+func TestTiDBWalkThrough(t *testing.T) {originDatabase := &storepb.DatabaseSchemaMetadata{Name: "test",}tests := []string{- "mysql_walk_through",+ "tidb_walk_through",}for _, test := range tests {- runWalkThroughTest(t, test, storepb.Engine_MYSQL, originDatabase, false /* record */)+ runWalkThroughTest(t, test, storepb.Engine_TIDB, originDatabase, false /* record */)}}@@ -52,7 +52,7 @@ func TestMySQLV2WalkThrough(t *testing.T) {}for _, test := range tests {- runWalkThroughTest(t, test, storepb.Engine_ENGINE_UNSPECIFIED, originDatabase, false /* record */)+ runWalkThroughTest(t, test, storepb.Engine_MYSQL, originDatabase, false /* record */)}}