[Django] #33246: --squashed-name can overwrite existing migration files

0 views
Skip to first unread message

Django

unread,
Oct 30, 2021, 4:21:29 PM10/30/21
to django-...@googlegroups.com
#33246: --squashed-name can overwrite existing migration files
--------------------------------------+------------------------
Reporter: AndrewN | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------+------------------------
`squashmigrations --squashed-name initial myapp 0002` will overwrite
`0001_initial.py`. If that migration has already been applied anywhere,
the code and the database will be in an inconsistent state. Furthermore,
the `0002_...` migration likely depends on `0001_initial`, so the new
`replaces = …0002…` line added to `0001_initial.py` introduces a
`CircularDependencyError`.

`squashmigrations` should exit with an error instead of overwriting
existing migration files.

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

Django

unread,
Oct 30, 2021, 4:50:14 PM10/30/21
to django-...@googlegroups.com
#33246: --squashed-name can overwrite existing migration files
----------------------------+--------------------------------------

Reporter: AndrewN | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: dev
Severity: Normal | Resolution:

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

Comment (by AndrewN):

PR: https://github.com/django/django/pull/15038

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

Django

unread,
Nov 1, 2021, 12:03:03 AM11/1/21
to django-...@googlegroups.com
#33246: --squashed-name can overwrite existing migration files
--------------------------------------+------------------------------------
Reporter: AndrewN | Owner: AndrewN
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

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

* owner: nobody => AndrewN
* status: new => assigned
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


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

Django

unread,
Nov 1, 2021, 1:20:04 AM11/1/21
to django-...@googlegroups.com
#33246: --squashed-name can overwrite existing migration files
--------------------------------------+------------------------------------
Reporter: AndrewN | Owner: AndrewN
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: dev

Severity: Normal | Resolution:
Keywords: | 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/33246#comment:3>

Django

unread,
Nov 2, 2021, 2:05:37 AM11/2/21
to django-...@googlegroups.com
#33246: --squashed-name can overwrite existing migration files
-------------------------------------+-------------------------------------
Reporter: AndrewN | Owner: AndrewN
Type: | Status: assigned
Cleanup/optimization |
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: | 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):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


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

Django

unread,
Nov 2, 2021, 2:13:58 AM11/2/21
to django-...@googlegroups.com
#33246: --squashed-name can overwrite existing migration files
-------------------------------------+-------------------------------------
Reporter: AndrewN | Owner: AndrewN
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: dev
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: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

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


Comment:

In [changeset:"9e6d6316977d5668a1d2d1f77b861b2b9323dcdf" 9e6d6316]:
{{{
#!CommitTicketReference repository=""
revision="9e6d6316977d5668a1d2d1f77b861b2b9323dcdf"
Fixed #33246 -- Made squashmigrations raise CommandError when
squashed_name already exists.
}}}

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

Reply all
Reply to author
Forward
0 new messages