--
Ticket URL: <https://code.djangoproject.com/ticket/31583>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Someday/Maybe
Comment:
Not sure we should do that as it seems pretty niche.
I guess an alternative API could be to allow passing a `UniqueConstraint`
to the `unique` kwarg like we've discussed doing to the `Field.index` one.
e.g.
{{{#!python
OneToOneField(OtherModel,
unique=UniqueConstraint(defer=models.Deferrable.DEFERRED))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31583#comment:1>
* cc: Ian Foote (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/31583#comment:2>
* cc: Petr Přikryl (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/31583#comment:3>
Comment (by Petr Přikryl):
I think it would be quite easy. Here we could pass `deferrable` argument
based on `new_field.defer` value:
https://github.com/django/django/blob/4.0/django/db/backends/base/schema.py#L810
https://github.com/django/django/blob/4.0/django/db/backends/base/schema.py#L1245
--
Ticket URL: <https://code.djangoproject.com/ticket/31583#comment:4>