Migrator allow to change from NOT NULL to DEFAULT NULL

This commit is contained in:
Paulius Jarmalavičius 2022-09-01 09:46:16 +03:00
parent 8c3018b96a
commit bcb72fdddd

View File

@ -437,8 +437,8 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
// check nullable // check nullable
if nullable, ok := columnType.Nullable(); ok && nullable == field.NotNull { if nullable, ok := columnType.Nullable(); ok && nullable == field.NotNull {
// not primary key & database is nullable // not primary key
if !field.PrimaryKey && nullable { if !field.PrimaryKey {
alterColumn = true alterColumn = true
} }
} }