Open simkimsia opened 3 years ago
this library is in maintenance mode. so you need to move away if you want to upgrade to django 3.0
I am in the midst of doing so.
here's how I'm upgrading.
General idea: switch to UniqueConstraint with condition available in django 2.2. see https://docs.djangoproject.com/en/3.0/ref/models/constraints/#condition for details
makemigrations
migrate
Done.
Step 2 and 3 can be compressed into a single step after you run step 2 and 3 separately once to gain confidence.
2 and 3 can become "replace partialindex with uniqueconstraint then makemigrations"
Originally
class Meta: indexes = [ PartialIndex( fields=["serial_number", "sheet"], unique=True, where=PQ(is_removed=False) ), ]
Now
class Meta: constraints = [ models.UniqueConstraint( fields=["serial_number", "sheet"], condition=models.Q(is_removed=False), name="unique_serial_number_in_sheet_for_nondeleted", ) ]
I almost exclusively use this library to write partial unique constraints. So I have nothing to add about situations where partial index is used for non unique. Sorry.
this library is in maintenance mode. so you need to move away if you want to upgrade to django 3.0
I am in the midst of doing so.
here's how I'm upgrading.
if u use unique=True
General idea: switch to UniqueConstraint with condition available in django 2.2. see https://docs.djangoproject.com/en/3.0/ref/models/constraints/#condition for details
Step by Step
makemigrations
migrate
Done.
Step 2 and 3 can be compressed into a single step after you run step 2 and 3 separately once to gain confidence.
2 and 3 can become "replace partialindex with uniqueconstraint then
makemigrations
"An actual example I use
Originally
Now
I almost exclusively use this library to write partial unique constraints. So I have nothing to add about situations where partial index is used for non unique. Sorry.