Opened 4 years ago
Closed 4 years ago
#32780 closed Cleanup/optimization (fixed)
Make covering and deferrable UniqueConstraint on SQLite a noop.
| Reported by: | Hannes Ljungberg | Owned by: | Hannes Ljungberg |
|---|---|---|---|
| Component: | Migrations | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
Creating a constraint like UniqueConstraint(fields=['name'], name='name_unq_covering', include=['weight']) on SQLite will issue the warning models.W039 stating that a constraint won't be created even though it is.
Change History (4)
comment:1 by , 4 years ago
| Has patch: | set |
|---|
comment:2 by , 4 years ago
| Patch needs improvement: | set |
|---|---|
| Summary: | Make covering UniqueConstraint on SQLite a no-op → Make covering and deferrable UniqueConstraint on SQLite a noop. |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Bug → Cleanup/optimization |
stating that a constraint won't be created even though it is.
That's not true, a constraint won't be created. However I agree that remaking table is not necessary and we can make it a noop. We can do the same for deferrable unique constraints.
comment:3 by , 4 years ago
That's not true, a constraint won't be created. However I agree that remaking table is not necessary and we can make it a noop. We can do the same for deferrable unique constraints.
Ah! I just assumed that the table would be recreated with the constraint. Thanks for clearing that up!
PR: https://github.com/django/django/pull/14444