﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29831	Add validation on the `--name` argument in makemigrations	Maxime Lorant	Prabakaran Kumaresshan	"After creating a new empty migration, I got an error when applying it. The error is pretty clear when you have the context but can be misleading for beginners: I created a migration containing a dot in its name so Django has split the migration and fails to import the module somehow.

{{{
$ 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.
"	Cleanup/optimization	closed	Migrations	2.1	Normal	fixed	migrations name makemigrations	Herbert Fortes	Accepted	1	0	0	0	1	0
