Opened 4 years ago

Closed 4 years ago

#25182 closed Bug (invalid)

Makemigration creates duplicate unlimited migrations when migrating from DateTimeField with auto_add_now to default=timezone.now()

Reported by: Dmitry Molotkov Owned by: nobody
Component: Migrations Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

So if we have a model with a field with auto_add_now=True and then change it to default=timezone.now() django will create a migration with fixed datetime value and will drop a warning that i should use timezone instead of fixed ( well - if timezone should be used why migration not created automatically with it from begin? and if it shouldnt be used in migration - then there shouldnt be this warning).
But thats a minor thing. The major is that even if migration is created it will create a new migraiton with everything same except different hardcoded date on each makemigration. So every run of makemigration will result in new migration added, which is really bad :(

Change History (1)

comment:1 Changed 4 years ago by Tim Graham

Resolution: invalid
Status: newclosed

It should be default=timezone.now (without parenthesis). I believe this will resolve both issues.

Note: See TracTickets for help on using tickets.
Back to Top