refactor: add reverse configuration and enhance transformation logic for PostgreSQL to SQL Server migration
This commit is contained in:
@@ -64,12 +64,28 @@ func computePostgresTransformationPlan(columns []models.ColumnType) []etl.Column
|
||||
|
||||
for i, col := range columns {
|
||||
switch col.SystemType() {
|
||||
case "int2", "int4", "int8", "integer", "smallint", "bigint":
|
||||
plan = append(plan, etl.ColumnTransformPlan{
|
||||
Index: i,
|
||||
Fn: func(v any) (any, error) {
|
||||
if v64, ok := ToInt64(v); ok {
|
||||
return v64, nil
|
||||
}
|
||||
return v, nil
|
||||
},
|
||||
})
|
||||
|
||||
case "uuid":
|
||||
plan = append(plan, etl.ColumnTransformPlan{
|
||||
Index: i,
|
||||
Fn: func(v any) (any, error) {
|
||||
if b, ok := v.([]byte); ok && b != nil {
|
||||
return bigEndianToMssqlUuid(b)
|
||||
switch b := v.(type) {
|
||||
case []byte:
|
||||
if b != nil {
|
||||
return bigEndianToMssqlUuid(b)
|
||||
}
|
||||
case [16]byte:
|
||||
return bigEndianToMssqlUuid(b[:])
|
||||
}
|
||||
return v, nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user