Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#26529 closed New feature (invalid)

migration: Add argument or flag which indicates the current db

Reported by: Kadir Owned by: nobody
Component: Uncategorized Version: 1.8
Severity: Normal Keywords: migration
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Two DB's which should have all the same models.

Running a RunPython migration on the second database fails since it still operates on the default database.

python migrate --database=seconddb

Except the hacky way, reading the sys.argv, there is no way to determine the current db to act upon that db.

Add a parameter (or extend an existing) to include a variable "database" which contains the current db.
apps.get_model should be able to get the schema for a specific db.

Change History (2)

comment:1 Changed 7 years ago by Tim Graham

Resolution: invalid
Status: newclosed

Use schema_editor.connection.alias to find the specified database as documented in the RunPython reference.

comment:2 Changed 7 years ago by Kadir

My humblest apology for asking prematurely!

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