Merge pull request #1 from wclssdn/add_autoIncrement_implement

Update migrator.go
This commit is contained in:
wclssdn 2022-06-23 18:29:51 +08:00 committed by GitHub
commit 7cf0819f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,6 +73,10 @@ func (m Migrator) FullDataTypeOf(field *schema.Field) (expr clause.Expr) {
expr.SQL += " NOT NULL" expr.SQL += " NOT NULL"
} }
if field.AutoIncrement {
expr.SQL += " AUTO_INCREMENT"
}
if field.Unique { if field.Unique {
expr.SQL += " UNIQUE" expr.SQL += " UNIQUE"
} }