Opened 4 years ago

Closed 4 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 Iuri de Silvio)

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:1 by Iuri de Silvio, 4 years ago

Last edited 4 years ago by Iuri de Silvio (previous) (diff)

comment:2 by Iuri de Silvio, 4 years ago

Owner: changed from nobody to Iuri de Silvio
Status: newassigned

comment:3 by Iuri de Silvio, 4 years ago

Description: modified (diff)

comment:4 by Iuri de Silvio, 4 years ago

Description: modified (diff)

comment:5 by Iuri de Silvio, 4 years ago

Version: 3.0master

comment:6 by Mariusz Felisiak, 4 years ago

Cc: Simon Charette added
Has patch: set
Summary: AlterField with only db_column changed should be a noopAlterField with db_column addition should be a noop.
Triage Stage: UnreviewedAccepted

Thanks. See related ticket when Simon pointed out that such change (1 & 2) should be a noop.

Version 1, edited 4 years ago by Mariusz Felisiak (previous) (next) (diff)

comment:7 by Mariusz Felisiak, 4 years ago

Patch needs improvement: set

comment:8 by Iuri de Silvio, 4 years ago

Patch needs improvement: unset

comment:9 by Iuri de Silvio, 4 years ago

Patch needs improvement: set

Patch needs improvement because it depends on #31825 merge and then I'll fix conflicts.

comment:10 by Iuri de Silvio, 4 years ago

Patch needs improvement: unset

comment:11 by Mariusz Felisiak, 4 years ago

Triage Stage: AcceptedReady for checkin

comment:12 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 632ccffc:

Fixed #31826 -- Made AlterField operation a noop when adding db_column.

AlterField operation with adding a db_column is a noop if the column
name is not changed.

Note: See TracTickets for help on using tickets.
Back to Top