Commit aa5ede3f by Ashley Penney

Merge pull request #1289 from MITx/bugfix/dave/dont_explode_askbot_migration

Add a try/catch so that Askbot removal doesn't die if there's no Askbot ...
parents 29c5d00b 5d664900
...@@ -26,6 +26,7 @@ class Migration(SchemaMigration): ...@@ -26,6 +26,7 @@ class Migration(SchemaMigration):
def forwards(self, orm): def forwards(self, orm):
"Kill the askbot" "Kill the askbot"
try:
# For MySQL, we're batching the alters together for performance reasons # For MySQL, we're batching the alters together for performance reasons
if db.backend_name == 'mysql': if db.backend_name == 'mysql':
drops = ["drop `{0}`".format(col) for col in ASKBOT_AUTH_USER_COLUMNS] drops = ["drop `{0}`".format(col) for col in ASKBOT_AUTH_USER_COLUMNS]
...@@ -34,6 +35,8 @@ class Migration(SchemaMigration): ...@@ -34,6 +35,8 @@ class Migration(SchemaMigration):
else: else:
for column in ASKBOT_AUTH_USER_COLUMNS: for column in ASKBOT_AUTH_USER_COLUMNS:
db.delete_column('auth_user', column) 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): def backwards(self, orm):
raise RuntimeError("Cannot reverse this migration: there's no going back to Askbot.") raise RuntimeError("Cannot reverse this migration: there's no going back to Askbot.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment