Opened 8 years ago

Closed 8 years ago

Last modified 8 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

Description

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

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

python manage.py 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.

Solution:
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 by Tim Graham, 8 years ago

Resolution: invalid
Status: newclosed

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

comment:2 by Kadir, 8 years ago

My humblest apology for asking prematurely!

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