feat(gaussdb): 新增 GaussDB 数据库连接支持

Refs #497
This commit is contained in:
Syngnat
2026-06-13 19:34:52 +08:00
parent f3dfffb8d1
commit d2f68acae8
70 changed files with 717 additions and 73 deletions

View File

@@ -207,7 +207,7 @@ func directImportPaginationPK(sourceType string, sourceCols []connection.ColumnD
func supportsDirectImportPagination(dbType string) bool {
switch normalizeMigrationDBType(dbType) {
case "mysql", "mariadb", "postgres", "kingbase", "highgo", "vastbase", "opengauss", "sqlserver", "sqlite", "duckdb", "clickhouse", "tdengine", "starrocks", "diros":
case "mysql", "mariadb", "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb", "sqlserver", "sqlite", "duckdb", "clickhouse", "tdengine", "starrocks", "diros":
return true
default:
return false

View File

@@ -119,7 +119,7 @@ func isMySQLLikeType(dbType string) bool {
func classifyMigrationDataModel(dbType string) MigrationDataModel {
switch normalizeMigrationDBType(dbType) {
case "mysql", "mariadb", "oceanbase", "postgres", "kingbase", "highgo", "vastbase", "opengauss", "oracle", "sqlserver", "dameng", "sqlite", "duckdb":
case "mysql", "mariadb", "oceanbase", "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb", "oracle", "sqlserver", "dameng", "sqlite", "duckdb":
return MigrationDataModelRelational
case "mongodb":
return MigrationDataModelDocument

View File

@@ -16,6 +16,8 @@ func normalizeMigrationDBType(dbType string) string {
return "kingbase"
case "opengauss", "open_gauss", "open-gauss":
return "opengauss"
case "gaussdb", "gauss_db", "gauss-db":
return "gaussdb"
case "dm", "dm8":
return "dameng"
case "sqlite3":
@@ -37,6 +39,8 @@ func resolveMigrationDBType(config connection.ConnectionConfig) string {
return "postgres"
case "opengauss", "open_gauss", "open-gauss":
return "opengauss"
case "gaussdb", "gauss_db", "gauss-db":
return "gaussdb"
case "dm", "dameng", "dm8":
return "dameng"
case "sqlite3", "sqlite":
@@ -64,6 +68,8 @@ func resolveMigrationDBType(config connection.ConnectionConfig) string {
switch {
case strings.Contains(driver, "opengauss"), strings.Contains(driver, "open_gauss"), strings.Contains(driver, "open-gauss"):
return "opengauss"
case strings.Contains(driver, "gaussdb"), strings.Contains(driver, "gauss_db"), strings.Contains(driver, "gauss-db"):
return "gaussdb"
case strings.Contains(driver, "postgres"):
return "postgres"
case strings.Contains(driver, "kingbase"):

View File

@@ -575,7 +575,7 @@ func intFromAny(v interface{}) int {
func isPGLikeSource(dbType string) bool {
switch normalizeMigrationDBType(dbType) {
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "duckdb":
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb", "duckdb":
return true
default:
return false
@@ -584,7 +584,7 @@ func isPGLikeSource(dbType string) bool {
func isPGLikeSameFamilyDDLType(dbType string) bool {
switch normalizeMigrationDBType(dbType) {
case "postgres", "kingbase", "highgo", "vastbase", "opengauss":
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb":
return true
default:
return false
@@ -1360,7 +1360,7 @@ func mapPGLikeDefaultToMySQL(col connection.ColumnDefinition, targetType string)
func isPGLikeTarget(dbType string) bool {
switch normalizeMigrationDBType(dbType) {
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "duckdb":
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb", "duckdb":
return true
default:
return false

View File

@@ -505,7 +505,7 @@ func (s *SyncEngine) runSourceQuerySync(config SyncConfig) SyncResult {
deletes := make([]map[string]interface{}, 0)
applyTableName := ctx.TargetTable
switch ctx.TargetType {
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "sqlserver":
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb", "sqlserver":
applyTableName = ctx.TargetQueryTable
}

View File

@@ -167,7 +167,7 @@ func normalizeSchemaAndTable(dbType string, dbName string, tableName string) (st
}
switch normalizedType {
case "postgres", "kingbase", "highgo", "vastbase", "opengauss":
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb":
return "public", rawTable
case "duckdb":
return "main", rawTable
@@ -186,7 +186,7 @@ func qualifiedNameForQuery(dbType string, schema string, table string, original
}
switch normalizeMigrationDBType(dbType) {
case "postgres", "kingbase", "highgo", "vastbase", "opengauss":
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb":
s := strings.TrimSpace(schema)
if s == "" {
s = "public"

View File

@@ -214,7 +214,7 @@ func (s *SyncEngine) RunSync(config SyncConfig) SyncResult {
sourceQueryTable, targetQueryTable := plan.SourceQueryTable, plan.TargetQueryTable
applyTableName := targetTable
switch targetType {
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "sqlserver":
case "postgres", "kingbase", "highgo", "vastbase", "opengauss", "gaussdb", "sqlserver":
applyTableName = targetQueryTable
}