#34568: makemigrations --update changes the name of custom migration name
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by David Sanders:
Old description:
> This may be intentional behaviour but the docs don't mention this so
> creating a ticket to update docs or correct behaviour:
>
> If you create a migration with a custom name:
>
> {{{
> $ ./manage.py makemigrations --name foo
> Migrations for 'update_rename':
> update_rename/migrations/0001_foo.py
> - Create model Foo
> }}}
>
> then running `--update` will change the name "foo" to the autogenerated
> one based on the operations:
>
> {{{
> $ ./manage.py makemigrations --update
> Migrations for 'update_rename':
> update_rename/migrations/0001_initial.py
> - Create model Foo
> Deleted update_rename/migrations/0001_foo.py
> }}}
>
> My opinion is that it shouldn't as it violates the principle of least
> astonishment ''even though the `--name` argument wasn't supplied''.
New description:
This may be intentional behaviour but the docs don't mention this so
creating a ticket to update docs or correct behaviour:
If you create a migration with a custom name:
{{{
$ ./manage.py makemigrations --name foo
Migrations for 'update_rename':
update_rename/migrations/0001_foo.py
- Create model Foo
}}}
then running `--update` will change the name "foo" to the autogenerated
one based on the operations:
{{{
$ ./manage.py makemigrations --update
Migrations for 'update_rename':
update_rename/migrations/0001_initial.py
- Create model Foo
Deleted update_rename/migrations/0001_foo.py
}}}
My opinion is that it shouldn't as it violates the principle of least
astonishment ''even though the `--name` argument wasn't supplied''.
EDIT:
This is my first time using --update and here are a few other observations
which could indicate that it requires broader discussion:
- It doesn't utilise the --name argument so it's impossible to customise
the name during --update
- It'd be nice to provide --no-optimize option to --update, here's my
use-case: 3-step non-null field addition. After doing nullable step 1,
elidable data migration step 2, I want to merge the step 3 non-null update
into the migration but --update optimizes this into a single step.
Perhaps --update requires a rethink?
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34568#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070188240178a6-67872487-4220-4589-923d-94bda55bed69-000000%40eu-central-1.amazonses.com.