#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.