{{{
$ python manage.py makemigrations myapp --empty -n "remove_foo.bar_thing"
Migrations for 'myapp':
myproject/myapp/migrations/0085_remove_foo.bar_thing.py
^ notice the dot here
$ python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 6, in <module>
execute_from_command_line(sys.argv)
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/core/management/__init__.py", line 371, in
execute_from_command_line
utility.execute()
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/core/management/commands/migrate.py", line 79, in handle
executor = MigrationExecutor(connection,
self.migration_progress_callback)
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/db/migrations/loader.py", line 201, in build_graph
self.load_disk()
File "/data/.virtualenvs/MY_VENV/lib/python3.5/site-
packages/django/db/migrations/loader.py", line 110, in load_disk
migration_module = import_module("%s.%s" % (module_name,
migration_name))
File "/data/.virtualenvs/MY_VENV/lib/python3.5/importlib/__init__.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 944, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in
_call_with_frames_removed
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in
_find_and_load_unlocked
ImportError: No module named 'myproject.myapp.migrations.0085_remove_foo'
}}}
I suggest to add a validation step that fails when the migration name
supplied with the `-n/--name` argument contains dots (and why not spaces
too?).
To be honest, I only tried this on Django 2.0.x, but I did not see any
changes about this problem in Django 2.1 releases notes.
--
Ticket URL: <https://code.djangoproject.com/ticket/29831>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => nixphix
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/29831#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/29831#comment:2>
* cc: Herbert Fortes (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/29831#comment:3>
Comment (by Herbert Fortes):
Replying to [comment:1 Prabakaran Kumaresshan]:
Hi,
How are things going?
My first thought is to edit
[https://github.com/django/django/blob/master/django/core/management/commands/makemigrations.py#L63
makemigrations] and
[https://github.com/django/django/blob/8ef8bc0f64c463684268a7c55f3d3da4de066c0d/tests/migrations/test_commands.py#L1323
test_commands]
I am not pushing. Not at all. I am just talking about the ticket. Feel
free.
--
Ticket URL: <https://code.djangoproject.com/ticket/29831#comment:4>
Comment (by Prabakaran Kumaresshan):
Replying to [comment:4 Herbert Fortes]:
> Replying to [comment:1 Prabakaran Kumaresshan]:
>
> Hi,
>
> How are things going?
>
> My first thought is to edit
[https://github.com/django/django/blob/master/django/core/management/commands/makemigrations.py#L63
makemigrations] and
[https://github.com/django/django/blob/8ef8bc0f64c463684268a7c55f3d3da4de066c0d/tests/migrations/test_commands.py#L1323
test_commands]
>
> I am not pushing. Not at all. I am just talking about the ticket. Feel
free.
Hi,
This is my first contribution. I figured the code that needs patch just
wondering where to place test scripts, thanks for the link.
I'll do regression and apply patch then let you know.
Much appreciate your help
--
Ticket URL: <https://code.djangoproject.com/ticket/29831#comment:5>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29831#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"10d82c85aa5f8bd6adff0db49798dd368455cdcf" 10d82c8]:
{{{
#!CommitTicketReference repository=""
revision="10d82c85aa5f8bd6adff0db49798dd368455cdcf"
Fixed #29831 -- Added validation for makemigrations --name.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29831#comment:7>