I'm finding this setup is not fully supported by Django, in that I'm
unable to migrate any changes to indexes or constraints.
The query that retrieves the old SQL object to update
(django.db.backends.postgresql.introspection.DatabaseIntrospection.get_constraints)
retrieves any object matching the name. The problem is that it's able to
see across any schema the current user has access to, and not just the
current schema being migrated, resulting in an error like:
ValueError: Found wrong number (7) of constraints for
myapp_mytable(col1, col2, col3)
i.e. This error would be thrown if I had 7 schemas on a database, all
containing the same constraint, and I tried to migrate one of the schemas.
I've been able to work around this issue by monkey patching the
get_constraints method using a variation of my submitted patch
(https://github.com/django/django/pull/14067), which just updates the
query to filter by the current schema.
--
Ticket URL: <https://code.djangoproject.com/ticket/32495>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => duplicate
Comment:
> I'm finding this setup is not fully supported by Django, in that I'm
unable to migrate any changes to indexes or constraints.
Yes it's not supported, official support for database schemas is discussed
in #6148.
--
Ticket URL: <https://code.djangoproject.com/ticket/32495#comment:1>