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 ...
This commit is contained in:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user