-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide support for UniqueConstraint.deferrable
Django allows a `deferrable` argument. Accepted values are Deferrable.DEFERRED or Deferrable.IMMEDIATE. For example: ``` from django.db.models import Deferrable, UniqueConstraint UniqueConstraint( name="unique_int_field", fields=["int_field"], deferrable=Deferrable.DEFERRED, ) ``` If Deferrable.DEFERRED, the migration output is: ```sql ALTER TABLE "foo" ADD CONSTRAINT "unique_int_field" UNIQUE ("int_field") DEFERRABLE INITIALLY DEFERRED; ``` If Deferrable.IMMEDIATE, the migration output is: ```sql ALTER TABLE "foo" DROP CONSTRAINT "unique_int_field"; ``` The DEFERRABLE INITIALLY IMMEDIATE setup is the default, so Django doesn't have to alter the DDL statement. We follow this practice in this repo too to be as close to Django as possible.
- Loading branch information
1 parent
fd937dc
commit dbd673e
Showing
4 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters