Opened 3 years ago
Closed 3 years ago
#31826 closed Cleanup/optimization (fixed)
AlterField with db_column addition should be a noop.
Reported by: | Iuri de Silvio | Owned by: | Iuri de Silvio |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Simon Charette | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When I change pink = models.Integer(default=0)
to pink = models.Integer(default=0, db_column="pink")
the migration drop/create the same constraints when it is an FK or even reconstruct the table (SQLite), but nothing really changed. The constraint drop/create is a blocking operation for PostgreSQL, so it is an undesirable and unexpected behavior.
Change History (12)
comment:2 Changed 3 years ago by
Owner: | changed from nobody to Iuri de Silvio |
---|---|
Status: | new → assigned |
comment:3 Changed 3 years ago by
Description: | modified (diff) |
---|
comment:4 Changed 3 years ago by
Description: | modified (diff) |
---|
comment:5 Changed 3 years ago by
Version: | 3.0 → master |
---|
comment:6 Changed 3 years ago by
Cc: | Simon Charette added |
---|---|
Has patch: | set |
Summary: | AlterField with only db_column changed should be a noop → AlterField with db_column addition should be a noop. |
Triage Stage: | Unreviewed → Accepted |
Thanks. See related ticket where Simon pointed out that such change (1 & 2) should be a noop.
comment:7 Changed 3 years ago by
Patch needs improvement: | set |
---|
comment:8 Changed 3 years ago by
Patch needs improvement: | unset |
---|
comment:9 Changed 3 years ago by
Patch needs improvement: | set |
---|
Patch needs improvement because it depends on #31825 merge and then I'll fix conflicts.
comment:10 Changed 3 years ago by
Patch needs improvement: | unset |
---|
comment:11 Changed 3 years ago by
Triage Stage: | Accepted → Ready for checkin |
---|
I sent a PR here. https://github.com/django/django/pull/13237