Skip to content

Commit

Permalink
Revert "Revert "feat: support type alias (go-gorm#90)""
Browse files Browse the repository at this point in the history
This reverts commit 58264fb.
  • Loading branch information
ishaan812 committed Oct 14, 2022
1 parent 7a4277c commit 2862605
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 2862605

Please sign in to comment.