#31318: sqlmigrate doesn't allow inspecting migrations that have been squashed
-------------------------------------------------+------------------------
Reporter: Adam (Chainz) Johnson | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------------+------------------------
This project for another ticket can be used to reproduce:
https://github.com/adamchainz/django-unique-together-bug
When running sqlmigrate to pick up migration 0001 in this project, it
complains that two migrations have that prefix:
{{{
$ python manage.py sqlmigrate testapp 0001
CommandError: More than one migration matches '0001' in app 'testapp'.
Please be more specific.
}}}
But when trying to be more specific, it's not possible to load it:
{{{
$ python manage.py sqlmigrate testapp 0001_initial
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/.../django/django/core/management/__init__.py", line 401, in
execute_from_command_line
utility.execute()
File "/.../django/django/core/management/__init__.py", line 395, in
execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/.../django/django/core/management/base.py", line 328, in
run_from_argv
self.execute(*args, **cmd_options)
File "/.../django/django/core/management/commands/sqlmigrate.py", line
30, in execute
return super().execute(*args, **options)
File "/.../django/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/.../django/django/core/management/commands/sqlmigrate.py", line
64, in handle
plan = [(executor.loader.graph.nodes[targets[0]],
options['backwards'])]
KeyError: ('testapp', '0001_initial')
}}}
It would be nice to:
A) catch this error and report a nice message as well
B) allow inspection of individual migrations that have been involved in a
squash. Normally the workflow is to remove the individual migrations some
time after committing the squash, but until that is done it could be
useful to see their sql.
--
Ticket URL: <https://code.djangoproject.com/ticket/31318>
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/053.f6c3e223118528891b187d59082dc1b5%40djangoproject.com.