Opened 88 minutes ago
Last modified 78 minutes ago
#36917 new New feature
sqlmigrate should accept migration file path as single argument
| Reported by: | Hendrik Richter | Owned by: | |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | 6.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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).