#35469: Squashing migrations from unique=True to unique=False to UniqueConstraint
produces irreversible migration on Postgres
-----------------------------+------------------------------------
Reporter: Jacob Walls | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Comment (by Jacob Walls):
Thanks for the link to #28646. It's related, but most of the discussion
there centers around the "boolean logic" cited in that ticket's OP. I
tried the various patches, and they don't fix my report because they just
shuffle the logic fathoming the booleans `db_index` and `unique` on
`old_field` and `new_fields`, whereas the problem here seems to be that
one of those values is wrong.
#26805 inspired me to check SlugField. I can't reproduce with SlugField,
leading me to wonder if it's something to do with `URLField`'s different
implementation of `deconstruct()`?
When using SlugField, and breaking on the comment "Added an index? ..." in
db/backends/postgresql/schema.py, I get:
{{{
(Pdb) new_field.db_index
True
}}}
versus with URLField:
{{{
(Pdb) new_field.db_index
False
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/35469#comment:4>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.