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
5d664900
Commit
5d664900
authored
Jan 16, 2013
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a try/catch so that Askbot removal doesn't die if there's no Askbot to remove from auth_user
parent
29c5d00b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
common/djangoapps/student/migrations/0021_remove_askbot.py
+11
-8
No files found.
common/djangoapps/student/migrations/0021_remove_askbot.py
View file @
5d664900
...
...
@@ -26,14 +26,17 @@ class Migration(SchemaMigration):
def
forwards
(
self
,
orm
):
"Kill the askbot"
# For MySQL, we're batching the alters together for performance reasons
if
db
.
backend_name
==
'mysql'
:
drops
=
[
"drop `{0}`"
.
format
(
col
)
for
col
in
ASKBOT_AUTH_USER_COLUMNS
]
statement
=
"alter table `auth_user` {0};"
.
format
(
", "
.
join
(
drops
))
db
.
execute
(
statement
)
else
:
for
column
in
ASKBOT_AUTH_USER_COLUMNS
:
db
.
delete_column
(
'auth_user'
,
column
)
try
:
# For MySQL, we're batching the alters together for performance reasons
if
db
.
backend_name
==
'mysql'
:
drops
=
[
"drop `{0}`"
.
format
(
col
)
for
col
in
ASKBOT_AUTH_USER_COLUMNS
]
statement
=
"alter table `auth_user` {0};"
.
format
(
", "
.
join
(
drops
))
db
.
execute
(
statement
)
else
:
for
column
in
ASKBOT_AUTH_USER_COLUMNS
:
db
.
delete_column
(
'auth_user'
,
column
)
except
Exception
as
ex
:
print
"Couldn't remove askbot because of {0} -- it was probably never here to begin with."
.
format
(
ex
)
def
backwards
(
self
,
orm
):
raise
RuntimeError
(
"Cannot reverse this migration: there's no going back to Askbot."
)
...
...
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