#32689: Infinite AlterField Migrations due to default callable object missmatch
-------------------------------------+-------------------------------------
Reporter: Samuel | Owner: nobody
Bishop |
Type: Bug | Status: new
Component: | Version: 3.2
Migrations | Keywords: infinite,
Severity: Normal | makemigrations, migrations,
Triage Stage: | callable, default, field
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
`makemigration` will generate infinite migrations if the callable path is
miss-matched such that you end up with two discreet callable objects (I'm
still trying to identify where exactly the migration framework is
generating this missmatch) then the same migration is generated every time
you run the command which results in no actual change to the database.
In my case it's from a custom field library being used as a primary key.
I was importing `from ulid.api import new as new_ulid` and setting
`default=new_ulid`, but unless I swap to `import ulid.api.api` and set
`default=ulid.api.api.Api.new` I just get a new identical migration
altering the field's default value to `ulid.api.api.Api.new` every time i
run `makemigrations`
I would have expected either a clear warning detailing why my choice of
callable object for the `default=` will cause issues, or I would have
expected `makemigrations` to not mutate my callable like this.
--
Ticket URL: <https://code.djangoproject.com/ticket/32689>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.de5d6318f407813a4755ac8d8d210310%40djangoproject.com.