-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
choices_display='WITH_GMT_OFFSET' kwarg causes django migrations to generate many AlterField() statements #74
Comments
Hi @jessemorton The Django migrations will make migrations even for changes to options that don't actually affect the database. For example, if you change the |
In this case nothing at all has been changing to the timezone field in question. So in other words, I have multiple migrations that were originally caused by me making other changes to the project, such as creating a new field on some other model, but the |
Gotcha, thanks. Two more questions if you please... what version of django are you using and are you using any options with the field? Like in your model, With that info I will try to reproduce on my end |
Thanks - Django version is 2.2.14 and here's the models setting:
|
Ok @jessemorton I have a handle on what's going on. This is an unintended (but foreseeable) effect of the I'm going to view this as a bug related to the
Once I release a new version of this package with those changes applied, you should get one more migrations.AlterField(
model_name='some_model_name',
name='some_field_name',
field=timezone_field.fields.TimeZoneField(choices_display='WITH_GMT_OFFSET'`, default='America/Chicago'),
) Once you apply that migration (or generate it and squash it with the previous migration without bothering to apply it should be safe, as long as this is the only operation in the migration) then this package should not generate any new migrations. Hopefully I'll be able to get this done this weekend (famous last words). Thanks a bunch for reporting this! |
Fixed on the Please let me know if you run into any problems with the fix! |
Thank you! |
Thanks for this project! Since upgrading to 4.1.1 earlier this year, every time I do
makemigrations
for other aspects of my project, an existing timezone field gets a migration too - so I have 5AlterField
operations that are all the same. Any idea what the cause of this would be or how to resolve?The text was updated successfully, but these errors were encountered: