[Django] #23953: makemigrations generates "wrong" numbered migration file if squashed migrations are in place

9 views
Skip to first unread message

Django

unread,
Dec 2, 2014, 9:41:58 PM12/2/14
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
--------------------------------------+--------------------
Reporter: MarkusH | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
When an app has migrations `0001_initial` and `0002_auto_20141202_1234`
that are squashed to `0001_squashed_0002_auto_20141202_1234`, a new call
to `makemigrations` will generate a migration file called
`0002_auto_20141202_2345` instead of `0003_auto_20141202_2345` which is
quite irritating as long as `0002_auto_20141202_1234` is still around. It
does make sense though when only `0001_squashed_0002_auto_20141202_1234`
is left.

Although the latter case eventually hits every project, I'd prefer the
former.

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

Django

unread,
Dec 3, 2014, 8:45:49 AM12/3/14
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.7
Component: Migrations | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Based on your logic, is it irritating to have `0001_initial` and
`0001_squashed_0002_auto_20141202_1234`? Should the first squashed
migration be `0003_...`?

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

Django

unread,
Dec 3, 2014, 9:00:13 AM12/3/14
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: 1.7
Component: Migrations | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by MarkusH):

I don't think so. The squashed migration replaces `0001` to `0002`, so
sticking to `0001` seems fine to me.

Rethinking the initial thought about `0002_auto_20141202_2345` making
sense if `0002_auto_20141202_1234` is gone an only the squashed migration
is around: no, it doesn't make sense. The squashed migration says "0001 to
0002 is squashed". Thus continuing with `0003` seems to be the right
choice.

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

Django

unread,
Dec 10, 2014, 11:17:02 AM12/10/14
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
--------------------------------------+------------------------------------

Reporter: MarkusH | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | 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):

* stage: Unreviewed => Accepted


Comment:

I guess it makes sense. If there is no way to reset the sequence of
migrations, I wonder what happens when app has 10K migrations.

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

Django

unread,
Dec 16, 2014, 3:59:04 PM12/16/14
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
--------------------------------------+------------------------------------
Reporter: MarkusH | Owner: proitm
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: 1.7

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

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

* status: new => assigned
* owner: nobody => proitm


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

Django

unread,
Oct 12, 2021, 3:16:15 PM10/12/21
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 1.7

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* owner: nobody => Jacob Walls


* status: new => assigned

* has_patch: 0 => 1
* easy: 0 => 1


Comment:

[https://github.com/django/django/pull/14983 PR]

Django

unread,
Oct 13, 2021, 3:32:52 AM10/13/21
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 1.7

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

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

* needs_better_patch: 0 => 1


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

Django

unread,
Oct 13, 2021, 9:40:57 PM10/13/21
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 1.7

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

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0


Comment:

Thanks for speedy review. Of course let me know if this is moving in the
wrong direction. Thanks.

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

Django

unread,
Oct 14, 2021, 1:00:05 AM10/14/21
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


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

Django

unread,
Oct 15, 2021, 1:28:11 AM10/15/21
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"15683cdb95eb471f801bd15aca47348f9bb6cba5" 15683cd]:
{{{
#!CommitTicketReference repository=""
revision="15683cdb95eb471f801bd15aca47348f9bb6cba5"
Fixed #23953 -- Made makemigrations continue number sequence for squashed
migrations.
}}}

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

Django

unread,
Oct 15, 2021, 1:28:11 AM10/15/21
to django-...@googlegroups.com
#23953: makemigrations generates "wrong" numbered migration file if squashed
migrations are in place
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

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

In [changeset:"6e4ac28af0ce52f770d62e6dcda29bc9dda713af" 6e4ac28a]:
{{{
#!CommitTicketReference repository=""
revision="6e4ac28af0ce52f770d62e6dcda29bc9dda713af"
Refs #23953 -- Added MigrationAutodetector.parse_number() tests.
}}}

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

Reply all
Reply to author
Forward
0 new messages