[Django] #36917: sqlmigrate should accept migration file path as single argument

0 views
Skip to first unread message

Django

unread,
Feb 10, 2026, 10:10:30 AM (2 days ago) Feb 10
to django-...@googlegroups.com
#36917: sqlmigrate should accept migration file path as single argument
-------------------------------------+-------------------------------------
Reporter: Hendrik Richter | Type: New
| feature
Status: new | Component: Core
| (Management commands)
Version: 6.0 | 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
-------------------------------------+-------------------------------------
Currently, after running `makemigrations`, the output shows the migration
file path:

{{{
Migrations for 'invoices':
invoices/migrations/0022_alter_invoice_country_code.py
- Alter field country_code on invoice
}}}

To use `sqlmigrate`, I need to manually split this into two arguments:

{{{./manage.py sqlmigrate invoices 0022_alter_invoice_country_code}}}

It would be more convenient if `sqlmigrate` also accepted the path
directly to make copy and pasting it easily possible:

{{{./manage.py sqlmigrate
invoices/migrations/0022_alter_invoice_country_code.py}}}

Similarly, `migrate --plan` outputs a dotted format:

{{{
Planned operations:
invoices.0022_alter_invoice_country_code
- Alter field country_code on invoice
}}}

It would be convenient to use this directly as well:

{{{./manage.py sqlmigrate invoices.0022_alter_invoice_country_code}}}

**Proposal:**
Make migration_name optional. When only one argument is provided, parse
app_label and migration_name from it, supporting both the path format
(`app/migrations/name.py`) and the dotted format (`app.migration_name`).
--
Ticket URL: <https://code.djangoproject.com/ticket/36917>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 10, 2026, 10:20:31 AM (2 days ago) Feb 10
to django-...@googlegroups.com
#36917: sqlmigrate should accept migration file path as single argument
-------------------------------------+-------------------------------------
Reporter: Hendrik Richter | Owner: (none)
Type: New feature | Status: new
Component: Core (Management | Version: 6.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hendrik Richter):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36917#comment:1>

Django

unread,
Feb 10, 2026, 3:27:20 PM (2 days ago) Feb 10
to django-...@googlegroups.com
#36917: sqlmigrate should accept migration file path as single argument
-------------------------------------+-------------------------------------
Reporter: Hendrik Richter | Owner: (none)
Type: New feature | Status: closed
Component: Core (Management | Version: 6.0
commands) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 1 => 0
* resolution: => wontfix
* status: new => closed

Comment:

Thanks for the proposal. If we go this route, this will introduce drift
against the `migrate` command, which also allows specifying a single
migration as a target by app name & migration name. To a lesser extent
this will also introduce some drift against `showmigrations`, where the
first argument is always an app label and not sometimes something else.
(The provided patch doesn't show the updates needed to the help text for
the `app_label` argument, which would become sometimes an app label but
sometimes not.)

For those reasons, I don't think this is appropriate to include in Django.
You can start a discussion elsewhere if you would like to gather
consensus.
--
Ticket URL: <https://code.djangoproject.com/ticket/36917#comment:2>
Reply all
Reply to author
Forward
0 new messages