Update migrator.go

add autoIncrement implement
This commit is contained in:
wclssdn 2022-06-23 18:29:06 +08:00 committed by GitHub
parent a70af2a4c0
commit 6470a9462f
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"
} }