Skip to content

Commit 7efd6ae

Browse files
committed
Merge pull request #78 from edx/jarv/overrides-for-migrations
adding overrides for migrations
2 parents 4b514db + 54801a7 commit 7efd6ae

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

xqueue/aws_migrate.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from .aws_settings import *
2+
3+
import os
4+
from django.core.exceptions import ImproperlyConfigured
5+
6+
DB_OVERRIDES = dict(
7+
PASSWORD=os.environ.get('DB_MIGRATION_PASS', None),
8+
ENGINE=os.environ.get('DB_MIGRATION_ENGINE', DATABASES['default']['ENGINE']),
9+
USER=os.environ.get('DB_MIGRATION_USER', DATABASES['default']['USER']),
10+
NAME=os.environ.get('DB_MIGRATION_NAME', DATABASES['default']['NAME']),
11+
HOST=os.environ.get('DB_MIGRATION_HOST', DATABASES['default']['HOST']),
12+
PORT=os.environ.get('DB_MIGRATION_PORT', DATABASES['default']['PORT']),
13+
)
14+
15+
if DB_OVERRIDES['PASSWORD'] is None:
16+
raise ImproperlyConfigured("No database password was provided for running "
17+
"migrations. This is fatal.")
18+
19+
for override, value in DB_OVERRIDES.iteritems():
20+
DATABASES['default'][override] = value

0 commit comments

Comments
 (0)