[Django] #24870: Create --update flag for makemigrations management command, mimicking South's one.

11 views
Skip to first unread message

Django

unread,
May 28, 2015, 10:01:04 AM5/28/15
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-----------------------------+-------------------------------
Reporter: dukebody | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords: migrations, south
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------
When I was developing with South I was able to use the `--update` flag for
the `schemamigration` management command
(http://south.readthedocs.org/en/latest/commands.html#schemamigration) to
refine the latest migration.

This was very convenient for iterative development. Could we have an
equivalent of the `--update` flag for Django>=1.7 makemigrations?

(I've taken it from http://stackoverflow.com/questions/30487909/what-is-
the-equivalent-of-souths-schemamigration-update-for-django-1-7)

--
Ticket URL: <https://code.djangoproject.com/ticket/24870>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 28, 2015, 10:35:31 AM5/28/15
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-----------------------------------+--------------------------------------

Reporter: dukebody | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:

Keywords: migrations, south | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by timgraham):

* cc: andrewgodwin (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Andrew, could you offer your view.

--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:1>

Django

unread,
May 28, 2015, 11:37:02 AM5/28/15
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-----------------------------------+--------------------------------------

Reporter: dukebody | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:

Keywords: migrations, south | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by andrewgodwin):

It's certainly possible, though more complicated than before in South
because of the multi-app nature of makemigrations - but also easier
because of the ease of programatically parsing and writing migration
files.

What this would be, in essence, is something that runs makemigrations and
glues the first migration it makes for each app to the most recent one
that already exists. The pain points I forsee are:

* Migration files that have custom code (RunPython especially, but also
any non-standard operation class) cannot be round-tripped through the
parser and then out through the writer, so they could not be appended
onto.

* Dependencies would have to be checked to make sure this merging of the
new migrations into old does not cause dependency loops.

* It will occasionally have to just make new migrations anyway - it's more
asking for a "best effort" attempt to make things work.

That said, I think it's not too complicated, and shares enough of these
challenges with squashing (it's basically squashing the new migrations
makemigrations creates into the last ones of the existing set), that we
should aim to do it at some point.

--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:2>

Django

unread,
May 28, 2015, 11:44:05 AM5/28/15
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-----------------------------------+------------------------------------

Reporter: dukebody | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by timgraham):

* cc: andrewgodwin (removed)
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:3>

Django

unread,
Jun 3, 2015, 3:23:43 AM6/3/15
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-----------------------------------+------------------------------------

Reporter: dukebody | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by MarkusH):

* version: 1.8 => master


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:4>

Django

unread,
May 6, 2022, 4:25:32 PM5/6/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* cc: David Wobrock (added)
* owner: nobody => David Wobrock
* has_patch: 0 => 1
* status: new => assigned


Comment:

Hello,

I tried to tackle this ticket as I believe it would still be a pretty
useful addition to `makemigrations`.
During development, I often see developers struggle with the manual steps
to re-generate a migration while they are still iterating on their
approach.

Here is the approach I've taken
https://github.com/django/django/pull/15669
I tried to keep the implementation rather straightforward.

The main drawback I see is that it will add a new edge case when one
updates a migration that has already been applied. This will create a bit
of confusion, as it will become more tedious to undo the updated
migration, since the reverse operations will try to undo things that
weren't initially applied.

--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:5>

Django

unread,
May 9, 2022, 7:26:13 AM5/9/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:6>

Django

unread,
May 23, 2022, 9:49:08 AM5/23/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:7>

Django

unread,
Jun 14, 2022, 3:22:07 AM6/14/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:8>

Django

unread,
Jun 15, 2022, 3:40:19 AM6/15/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* needs_better_patch: 1 => 0

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:9>

Django

unread,
Jun 16, 2022, 12:30:00 AM6/16/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:10>

Django

unread,
Jun 16, 2022, 12:05:08 PM6/16/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:11>

Django

unread,
Jun 17, 2022, 1:51:36 AM6/17/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:12>

Django

unread,
Jun 17, 2022, 3:44:07 AM6/17/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, south | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"3893fcdd94498da8f88ae7313b6939ab09bff509" 3893fcdd]:
{{{
#!CommitTicketReference repository=""
revision="3893fcdd94498da8f88ae7313b6939ab09bff509"
Refs #24870 -- Refactored out get_relative_path() hook in makemigrations.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:13>

Django

unread,
Jun 17, 2022, 3:44:08 AM6/17/22
to django-...@googlegroups.com
#24870: Create --update flag for makemigrations management command, mimicking
South's one.
-------------------------------------+-------------------------------------
Reporter: Israel Saeta Pérez | Owner: David
| Wobrock
Type: New feature | Status: closed
Component: Migrations | Version: dev
Severity: Normal | Resolution: fixed

Keywords: migrations, south | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"e286ce17ff8bf72a248ce3177bbd5163c50a6ded" e286ce17]:
{{{
#!CommitTicketReference repository=""
revision="e286ce17ff8bf72a248ce3177bbd5163c50a6ded"
Fixed #24870 -- Added --update option to makemigrations command.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24870#comment:14>

Reply all
Reply to author
Forward
0 new messages