Opened 10 years ago
Closed 10 years ago
#23302 closed New feature (fixed)
Give a name to a migration from command line option
Reported by: | Raffaele Salmaso | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | raffaele.salmaso@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
With south, I can (or must) give a (possibly meaningful) name to a migration step
$ ./manage.py schemamigration --auto add_a_flag
$ ./manage.py schemamigration --empty my_schema_change_name
With django migrations it is impossible, it defaults to some "random" text
$ ./manage.py makemigrations myapp --empty pippo App 'pippo' could not be found. Is it in INSTALLED_APPS?
you must change after creation
$ ./manage.py makemigrations myapp --empty $ cd $APP/migrations $ mv XXXX_23833_93333.py XXXX_migration.py
Attachments (1)
Change History (19)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
I've implemented --name option it against 1.7. If it is ok I'll make a proper PR against master
by , 10 years ago
Attachment: | django-1.7-makemigrations-patch.diff added |
---|
add --name/-n option to makemigrations
comment:3 by , 10 years ago
Has patch: | set |
---|
comment:5 by , 10 years ago
Cc: | added |
---|
comment:6 by , 10 years ago
Adding tests to master/1.7.x I've found a limitation of call_command: cannot call with name="" options (see https://code.djangoproject.com/ticket/23306)
Wondering if changing option from --name/-n to --label/-l is ok.
comment:7 by , 10 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Triage Stage: | Unreviewed → Accepted |
comment:8 by , 10 years ago
Type: | Uncategorized → New feature |
---|
comment:9 by , 10 years ago
Keep --name/-n option, works fine in master thanks to https://code.djangoproject.com/ticket/23309 and a workaround in 1.7.x backport (call makemigrations.Command().execute() directly).
I've added two PR with tests and a note in migrations doc.
PR against master https://github.com/django/django/pull/3090
PR against 1.7.x https://github.com/django/django/pull/3091
comment:10 by , 10 years ago
Summary: | Cannot give a name to a migration from command line → Give a name to a migration from command line option |
---|
comment:11 by , 10 years ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Patch needs improvement: | set |
In my opinion this isn't a release blocking issue, so it doesn't qualify for backport to 1.7. I left some comments for improvement on the PR against master.
comment:12 by , 10 years ago
PR updates with comments.
If the 1.7 backport is too late please close its PR (I can maintain a private "fork" or continue to use mv until 1.8) and I'll add the .. versionadded:: 1.8
string.
comment:14 by , 10 years ago
PR against master updated with versionadded in docs
PR against 1.7.x dropped
comment:15 by , 10 years ago
Patch needs improvement: | unset |
---|
comment:17 by , 10 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:18 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
A -n/--name option in makemigrations command could be ok