Fixed a migration that failed under mysql.
This commit is contained in:
parent
b465bdd7bb
commit
8c6b27b5b3
1 changed files with 3 additions and 2 deletions
|
|
@ -6,14 +6,15 @@ from django.db import models, utils
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
class Migration(SchemaMigration):
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
no_dry_run = True
|
||||||
def forwards(self, orm):
|
def forwards(self, orm):
|
||||||
try:
|
try:
|
||||||
db.rename_table("config_configvalue", "server_serverconfig")
|
db.rename_table("config_configvalue", "server_serverconfig")
|
||||||
for conf in orm.ServerConfig.objects.all():
|
for conf in orm.ServerConfig.objects.all():
|
||||||
conf.db_value = pickle.dumps(conf.db_value)
|
conf.db_value = pickle.dumps(conf.db_value)
|
||||||
conf.save()
|
conf.save()
|
||||||
except utils.DatabaseError:
|
except Exception: #utils.DatabaseError:
|
||||||
# this will happen if we start db from scratch (the config
|
# this will happen if we start db from scratch (the config
|
||||||
# app will then already be gone and no data is to be transferred)
|
# app will then already be gone and no data is to be transferred)
|
||||||
# So instead of renaming the old we instead have to manually create the new model.
|
# So instead of renaming the old we instead have to manually create the new model.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue