Skip to content

Commit

Permalink
feat: support type alias (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
a631807682 committed Oct 7, 2022
1 parent 14d485e commit ff88afd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions migrator.go
Expand Up @@ -26,6 +26,11 @@ ORDER BY
INDEX_NAME,
SEQ_IN_INDEX`

var typeAliasMap = map[string][]string{
"bool": {"tinyint"},
"tinyint": {"bool"},
}

type Migrator struct {
migrator.Migrator
Dialector
Expand Down Expand Up @@ -320,3 +325,7 @@ func (m Migrator) CurrentSchema(stmt *gorm.Statement, table string) (string, str

return m.CurrentDatabase(), table
}

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

0 comments on commit ff88afd

Please sign in to comment.