[Django] #26529: migration: Add argument or flag which indicates the current db

8 views
Skip to first unread message

Django

unread,
Apr 22, 2016, 8:03:53 AM4/22/16
to django-...@googlegroups.com
#26529: migration: Add argument or flag which indicates the current db
-------------------------------+-----------------------
Reporter: ktugan | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords: migration
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------
'''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.

--
Ticket URL: <https://code.djangoproject.com/ticket/26529>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 22, 2016, 8:44:14 AM4/22/16
to django-...@googlegroups.com
#26529: migration: Add argument or flag which indicates the current db
-------------------------------+--------------------------------------
Reporter: ktugan | Owner: nobody
Type: New feature | Status: closed
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution: invalid

Keywords: migration | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

Use `schema_editor.connection.alias` to find the specified database as
documented in the [https://docs.djangoproject.com/en/stable/ref/migration-
operations/#runpython RunPython reference].

--
Ticket URL: <https://code.djangoproject.com/ticket/26529#comment:1>

Django

unread,
Apr 22, 2016, 11:12:17 AM4/22/16
to django-...@googlegroups.com
#26529: migration: Add argument or flag which indicates the current db
-------------------------------+--------------------------------------
Reporter: ktugan | Owner: nobody
Type: New feature | Status: closed
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution: invalid

Keywords: migration | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by ktugan):

My humblest apology for asking prematurely!

--
Ticket URL: <https://code.djangoproject.com/ticket/26529#comment:2>

Reply all
Reply to author
Forward
0 new messages