Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
72b4cf37
Commit
72b4cf37
authored
Mar 01, 2016
by
Kevin Falcone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't hardcode student_module_history
aws_migrate may be used on boxes where that DB does not yet exist.
parent
447c189d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
cms/envs/aws_migrate.py
+19
-10
lms/envs/aws_migrate.py
+3
-1
No files found.
cms/envs/aws_migrate.py
View file @
72b4cf37
...
...
@@ -13,18 +13,27 @@ from .aws import *
import
os
from
django.core.exceptions
import
ImproperlyConfigured
DB_OVERRIDES
=
dict
(
def
get_db_overrides
(
db_name
):
"""
Now that we have multiple databases, we want to look up from the environment
for both databases.
"""
db_overrides
=
dict
(
PASSWORD
=
os
.
environ
.
get
(
'DB_MIGRATION_PASS'
,
None
),
ENGINE
=
os
.
environ
.
get
(
'DB_MIGRATION_ENGINE'
,
DATABASES
[
'default'
][
'ENGINE'
]),
USER
=
os
.
environ
.
get
(
'DB_MIGRATION_USER'
,
DATABASES
[
'default'
][
'USER'
]),
NAME
=
os
.
environ
.
get
(
'DB_MIGRATION_NAME'
,
DATABASES
[
'default'
][
'NAME'
]),
HOST
=
os
.
environ
.
get
(
'DB_MIGRATION_HOST'
,
DATABASES
[
'default'
][
'HOST'
]),
PORT
=
os
.
environ
.
get
(
'DB_MIGRATION_PORT'
,
DATABASES
[
'default'
][
'PORT'
]),
)
ENGINE
=
os
.
environ
.
get
(
'DB_MIGRATION_ENGINE'
,
DATABASES
[
db_name
][
'ENGINE'
]),
USER
=
os
.
environ
.
get
(
'DB_MIGRATION_USER'
,
DATABASES
[
db_name
][
'USER'
]),
NAME
=
os
.
environ
.
get
(
'DB_MIGRATION_NAME'
,
DATABASES
[
db_name
][
'NAME'
]),
HOST
=
os
.
environ
.
get
(
'DB_MIGRATION_HOST'
,
DATABASES
[
db_name
][
'HOST'
]),
PORT
=
os
.
environ
.
get
(
'DB_MIGRATION_PORT'
,
DATABASES
[
db_name
][
'PORT'
]),
)
if
DB_OVERRIDES
[
'PASSWORD'
]
is
None
:
if
db_overrides
[
'PASSWORD'
]
is
None
:
raise
ImproperlyConfigured
(
"No database password was provided for running "
"migrations. This is fatal."
)
return
db_overrides
DATABASES
[
'default'
]
.
update
(
DB_OVERRIDES
)
DATABASES
[
'student_module_history'
]
.
update
(
DB_OVERRIDES
)
for
db
in
DATABASES
:
# You never migrate a read_replica
if
db
!=
'read_replica'
:
DATABASES
[
db
]
.
update
(
get_db_overrides
(
db
))
lms/envs/aws_migrate.py
View file @
72b4cf37
...
...
@@ -33,5 +33,7 @@ def get_db_overrides(db_name):
"migrations. This is fatal."
)
return
db_overrides
for
db
in
[
'default'
,
'student_module_history'
]:
for
db
in
DATABASES
:
# You never migrate a read_replica
if
db
!=
'read_replica'
:
DATABASES
[
db
]
.
update
(
get_db_overrides
(
db
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment