#26529 closed New feature (invalid)
migration: Add argument or flag which indicates the current db
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.
Note:
See TracTickets
for help on using tickets.
Use
schema_editor.connection.alias
to find the specified database as documented in the RunPython reference.