mattiaslinnap / django-partial-index

PostgreSQL and SQLite partial index support for Django
BSD 3-Clause "New" or "Revised" License
116 stars 12 forks source link

Cannot create migrations when using index with `where` `PQ` object. #12

Closed jproffitt closed 6 years ago

jproffitt commented 6 years ago

I am trying to create an index like so:

PartialIndex(fields=['date_created', 'ignored', 'id'], unique=True, where=PQ(ignored=False))

But when I run makemigrations, django cannot serialize the PQ object into a migration. Here is the output:

ValueError: Cannot serialize: <PQ: (AND: ('ignored', False))>
There are some values Django cannot serialize into migration files.
For more, see https://docs.djangoproject.com/en/1.11/topics/migrations/#migration-serializing
mattiaslinnap commented 6 years ago

Hi @jproffitt , thanks for the report, will have a look!

Which version of Django are you using?

jproffitt commented 6 years ago

@mattiaslinnap thanks! I'm using django 1.11.14.

mattiaslinnap commented 6 years ago

@jproffitt I added tests for making and applying migrations, and fixed compatibility for Django 1.11. Please try the latest 0.5.2 release!

jproffitt commented 6 years ago

@mattiaslinnap works great! Thanks so much!