Re: [Django] #34568: makemigrations --update should respect the --name option.

10 views
Skip to first unread message

Django

unread,
May 16, 2023, 10:17:01 PM5/16/23
to django-...@googlegroups.com
#34568: makemigrations --update should respect the --name option.
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by David Sanders):

One more thing:

`--update` is a destructive operation – if you had any customised
migration operations or code in your latest migration this will be
permanently deleted if you run update *without any warning*.

I'd like to suggest that *at least* one of the following happen:

1. `--update` does a confirmation eg
"<app>/migrations/0009_last_migration.py will be replaced. Proceed? y/N".
Along with this we provide a `--no-input`. Both of these are consistent
with other commands.
2. we document that it destroys your last migration without warning

My preference is 1. because, to paraphrase FunkyBob, the purpose of any
framework is to manage the risky and the tedious.

We should at the very least do 2. if it's decided 1. is a no-go.

This also sounds like another ticket.

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

Django

unread,
May 17, 2023, 2:53:29 AM5/17/23
to django-...@googlegroups.com
#34568: makemigrations --update should respect the --name option.
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned

Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | 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 Mariusz Felisiak):

* owner: nobody => Mariusz Felisiak
* status: new => assigned


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

Django

unread,
May 17, 2023, 3:08:23 AM5/17/23
to django-...@googlegroups.com
#34568: makemigrations --update should respect the --name option.
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | 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):

* has_patch: 0 => 1


Comment:

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

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

Django

unread,
May 17, 2023, 7:15:31 AM5/17/23
to django-...@googlegroups.com
#34568: makemigrations --update should respect the --name option.
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed

Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution: fixed

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 GitHub <noreply@…>):

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


Comment:

In [changeset:"c52f4295f254e1c14af769d22b1a5f516a941f58" c52f429]:
{{{
#!CommitTicketReference repository=""
revision="c52f4295f254e1c14af769d22b1a5f516a941f58"
Fixed #34568 -- Made makemigrations --update respect --name option.

Thanks David Sanders for the report.
}}}

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

Django

unread,
May 17, 2023, 7:16:02 AM5/17/23
to django-...@googlegroups.com
#34568: makemigrations --update should respect the --name option.
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
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:"cdd970ae22303e6c58b5c1f3ba695c470a811b56" cdd970ae]:
{{{
#!CommitTicketReference repository=""
revision="cdd970ae22303e6c58b5c1f3ba695c470a811b56"
[4.2.x] Fixed #34568 -- Made makemigrations --update respect --name
option.

Thanks David Sanders for the report.

Backport of c52f4295f254e1c14af769d22b1a5f516a941f58 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34568#comment:15>

Django

unread,
May 17, 2023, 9:49:26 AM5/17/23
to django-...@googlegroups.com
#34568: makemigrations --update should respect the --name option.
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Natalia Bidart):

Replying to [comment:11 David Sanders]:


> One more thing:
>
> `--update` is a destructive operation – if you had any customised
migration operations or code in your latest migration this will be
permanently deleted if you run update *without any warning*.
>
> I'd like to suggest that *at least* one of the following happen:
>
> 1. `--update` does a confirmation eg
"<app>/migrations/0009_last_migration.py will be replaced. Proceed? y/N".
Along with this we provide a `--no-input`. Both of these are consistent
with other commands.
> 2. we document that it destroys your last migration without warning
>
> My preference is 1. because, to paraphrase FunkyBob, the purpose of any
framework is to manage the risky and the tedious.
>
> We should at the very least do 2. if it's decided 1. is a no-go.
>
> This also sounds like another ticket.

I agree this should be another ticket, and I also agree overwriting
without any warning feels like an antipattern. I would definitely go with
(1).

Having said the above, are you positive overwrites are happening? If so,
could you please provide the sequence of commands that would trigger that
situation in the new ticket? Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/34568#comment:16>

Reply all
Reply to author
Forward
0 new messages