From c6e74c27b826555f0a8940cb76f12664f9f54547 Mon Sep 17 00:00:00 2001 From: actiontech-zihan Date: Thu, 21 May 2026 16:09:01 +0000 Subject: [PATCH 1/3] feat(constant): add DBTypeOpenGauss + ParseDBType case for openGauss support (#2905) --- internal/dms/pkg/constant/const.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/dms/pkg/constant/const.go b/internal/dms/pkg/constant/const.go index 18741600..591d4280 100644 --- a/internal/dms/pkg/constant/const.go +++ b/internal/dms/pkg/constant/const.go @@ -250,6 +250,8 @@ func ParseDBType(s string) (DBType, error) { return DBTypeDM, nil case "GaussDB": return DBTypeGaussDB, nil + case "openGauss", "OPENGAUSS", "opengauss": + return DBTypeOpenGauss, nil case "GaussDB for MySQL": return DBTypeGaussDBForMySQL, nil case "HANA": @@ -278,6 +280,7 @@ const ( DBTypeHive DBType = "Hive" DBTypeDM DBType = "达梦(DM)" DBTypeGaussDB DBType = "GaussDB" + DBTypeOpenGauss DBType = "openGauss" DBTypeGaussDBForMySQL DBType = "GaussDB for MySQL" DBTypeHANA DBType = "HANA" DBTypePolarDBForMySQL DBType = "PolarDB For MySQL" From 4e48dee504375e2b02d02819dd4906148409cfce Mon Sep 17 00:00:00 2001 From: actiontech-zihan Date: Thu, 21 May 2026 16:09:12 +0000 Subject: [PATCH 2/3] test(constant): assert ParseDBType resolves openGauss three-case + GaussDB regression (#2905) --- internal/dms/pkg/constant/const_test.go | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/internal/dms/pkg/constant/const_test.go b/internal/dms/pkg/constant/const_test.go index 71c14a9b..6a9b9ce2 100644 --- a/internal/dms/pkg/constant/const_test.go +++ b/internal/dms/pkg/constant/const_test.go @@ -152,3 +152,35 @@ func TestParseDBType(t *testing.T) { }) } } + +func TestParseDBType_OpenGauss_EE(t *testing.T) { + cases := map[string]struct { + input string + want DBType + wantErr bool + }{ + "openGauss literal": {input: "openGauss", want: DBTypeOpenGauss, wantErr: false}, + "OPENGAUSS upper": {input: "OPENGAUSS", want: DBTypeOpenGauss, wantErr: false}, + "opengauss lower": {input: "opengauss", want: DBTypeOpenGauss, wantErr: false}, + "GaussDB regression": {input: "GaussDB", want: DBTypeGaussDB, wantErr: false}, + "GaussDB for MySQL regression": {input: "GaussDB for MySQL", want: DBTypeGaussDBForMySQL, wantErr: false}, + "Unknown returns explicit error": {input: "Unknown", want: DBType(""), wantErr: true}, + } + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + got, err := ParseDBType(tc.input) + if tc.wantErr { + if err == nil { + t.Fatalf("expected error for input %q, got nil", tc.input) + } + return + } + if err != nil { + t.Fatalf("unexpected error for input %q: %v", tc.input, err) + } + if got != tc.want { + t.Fatalf("ParseDBType(%q): got %q, want %q", tc.input, got, tc.want) + } + }) + } +} From 55bdfc195972815e06b456ec2fe1a660a775d8c5 Mon Sep 17 00:00:00 2001 From: actiontech-zihan Date: Tue, 26 May 2026 05:43:56 +0000 Subject: [PATCH 3/3] revert: remove DBTypeOpenGauss constant + ParseDBType openGauss case (#2905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按 fix_session_20260526_053311 用户反馈: > 禁止将opengauss单列出来,它和华为云GaussDB对于sqle平台来说是一样的, > 都是通过gaussdb插件连接管理。 > 理论上数据库结构对比功能不涉及dms、sqle代码改动。 回退两个 commit: - c6e74c27 feat(constant): add DBTypeOpenGauss + ParseDBType case for openGauss - 4e48dee5 test(constant): assert ParseDBType resolves openGauss three-case openGauss 不再作为独立 DBType;GaussDB / openGauss 统一为 DBTypeGaussDB="GaussDB" (通过 GitLab sqle-gaussdb-plugin 同一 PluginName 连接)。dms 代码恢复零改动状态。 --- internal/dms/pkg/constant/const.go | 3 --- internal/dms/pkg/constant/const_test.go | 32 ------------------------- 2 files changed, 35 deletions(-) diff --git a/internal/dms/pkg/constant/const.go b/internal/dms/pkg/constant/const.go index 591d4280..18741600 100644 --- a/internal/dms/pkg/constant/const.go +++ b/internal/dms/pkg/constant/const.go @@ -250,8 +250,6 @@ func ParseDBType(s string) (DBType, error) { return DBTypeDM, nil case "GaussDB": return DBTypeGaussDB, nil - case "openGauss", "OPENGAUSS", "opengauss": - return DBTypeOpenGauss, nil case "GaussDB for MySQL": return DBTypeGaussDBForMySQL, nil case "HANA": @@ -280,7 +278,6 @@ const ( DBTypeHive DBType = "Hive" DBTypeDM DBType = "达梦(DM)" DBTypeGaussDB DBType = "GaussDB" - DBTypeOpenGauss DBType = "openGauss" DBTypeGaussDBForMySQL DBType = "GaussDB for MySQL" DBTypeHANA DBType = "HANA" DBTypePolarDBForMySQL DBType = "PolarDB For MySQL" diff --git a/internal/dms/pkg/constant/const_test.go b/internal/dms/pkg/constant/const_test.go index 6a9b9ce2..71c14a9b 100644 --- a/internal/dms/pkg/constant/const_test.go +++ b/internal/dms/pkg/constant/const_test.go @@ -152,35 +152,3 @@ func TestParseDBType(t *testing.T) { }) } } - -func TestParseDBType_OpenGauss_EE(t *testing.T) { - cases := map[string]struct { - input string - want DBType - wantErr bool - }{ - "openGauss literal": {input: "openGauss", want: DBTypeOpenGauss, wantErr: false}, - "OPENGAUSS upper": {input: "OPENGAUSS", want: DBTypeOpenGauss, wantErr: false}, - "opengauss lower": {input: "opengauss", want: DBTypeOpenGauss, wantErr: false}, - "GaussDB regression": {input: "GaussDB", want: DBTypeGaussDB, wantErr: false}, - "GaussDB for MySQL regression": {input: "GaussDB for MySQL", want: DBTypeGaussDBForMySQL, wantErr: false}, - "Unknown returns explicit error": {input: "Unknown", want: DBType(""), wantErr: true}, - } - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - got, err := ParseDBType(tc.input) - if tc.wantErr { - if err == nil { - t.Fatalf("expected error for input %q, got nil", tc.input) - } - return - } - if err != nil { - t.Fatalf("unexpected error for input %q: %v", tc.input, err) - } - if got != tc.want { - t.Fatalf("ParseDBType(%q): got %q, want %q", tc.input, got, tc.want) - } - }) - } -}