Skip to content

Commit

Permalink
feat: support type alias (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
a631807682 committed Oct 7, 2022
1 parent 9e7a2bb commit 6145461
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions migrator.go
Expand Up @@ -34,6 +34,17 @@ where
and t.relname = ?
`

var typeAliasMap = map[string][]string{
"int2": {"smallint"},
"int4": {"integer"},
"int8": {"bigint"},
"smallint": {"int2"},
"integer": {"int4"},
"bigint": {"int8"},
"decimal": {"numeric"},
"numeric": {"decimal"},
}

type Migrator struct {
migrator.Migrator
}
Expand Down Expand Up @@ -676,3 +687,7 @@ func groupByIndexName(indexList []*Index) map[string][]*Index {
}
return columnIndexMap
}

func (m Migrator) GetTypeAliases(databaseTypeName string) []string {
return typeAliasMap[databaseTypeName]
}

0 comments on commit 6145461

Please sign in to comment.