#36374: postgres ExclusionConstraint with multiple expressions breaks
`create_model`
-------------------------------------+-------------------------------------
Reporter: anthony sottile | Owner: (none)
Type: Bug | Status: closed
Component: Database layer | Version: 5.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by anthony sottile):
this seems more helpful (and is not as specific) but I think something
like this could live in the postgres schema editor:
{{{
class MakeBtreeGistSchemaEditor(PostgresDatabaseSchemaEditor):
"""workaround for https://code.djangoproject.com/ticket/36374"""
def create_model(self, model: type[Model]) -> None:
if any(isinstance(c, ExclusionConstraint) for c in
model._meta.constraints):
self.execute('CREATE EXTENSION IF NOT EXISTS btree_gist;')
super().create_model(model)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36374#comment:3>
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 visit
https://groups.google.com/d/msgid/django-updates/01070196ac9a45e2-31d0dc81-9942-4240-84a2-c9eda46a8c19-000000%40eu-central-1.amazonses.com.