Skip to content

Commit 6145461

Browse files
authored
feat: support type alias (#133)
1 parent 9e7a2bb commit 6145461

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

migrator.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ where
3434
and t.relname = ?
3535
`
3636

37+
var typeAliasMap = map[string][]string{
38+
"int2": {"smallint"},
39+
"int4": {"integer"},
40+
"int8": {"bigint"},
41+
"smallint": {"int2"},
42+
"integer": {"int4"},
43+
"bigint": {"int8"},
44+
"decimal": {"numeric"},
45+
"numeric": {"decimal"},
46+
}
47+
3748
type Migrator struct {
3849
migrator.Migrator
3950
}
@@ -676,3 +687,7 @@ func groupByIndexName(indexList []*Index) map[string][]*Index {
676687
}
677688
return columnIndexMap
678689
}
690+
691+
func (m Migrator) GetTypeAliases(databaseTypeName string) []string {
692+
return typeAliasMap[databaseTypeName]
693+
}

0 commit comments

Comments
 (0)