Opened 8 years ago

Closed 8 years ago

#25975 closed New feature (duplicate)

sqlmigrate for pending migrations

Reported by: Senthil Kumaran Owned by: nobody
Component: Migrations Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When there are no app_label and migration_name supplied to the sqlmigrate command the following error is given (instead of showing the forwards SQL statements of pending migrations):

# python manage.py sqlmigrate
sqlmigrate: error: too few arguments
...

the above is not same as the behavior found in migrate command, wherein all pending migrations are carried out in migrate command. Similarly, sqlmigrate probably should show the SQL statements for all pending migrations when there is no "app_label" and "migration_name" are supplied for forwards migration. This also proves useful on a project where multiple apps are included.

The way in which db migration APIs are available currently in django, we cannot show all SQL statements for "backwards" migration, hence only when "app_label" and "migration_name" are provided we can show SQL statements for "backwards" migration which is the current behavior.

Change History (3)

comment:1 by Senthil Kumaran, 8 years ago

The patch which implements this feature is available as a pull request here - https://github.com/django/django/pull/5861

comment:2 by Tim Graham, 8 years ago

Do you have a use case in mind for this feature? #24481 is a related ticket which might address it.

comment:3 by Markus Holtermann, 8 years ago

Resolution: duplicate
Status: newclosed

I agree with Tim that this is a duplicate of #24481 and should be converted by that change. Please leave a note there if you feel that your use case is not covered.

I appreciate your work and would be happy to review a patch that tackles the mentioned ticket.

Note: See TracTickets for help on using tickets.
Back to Top