Fix migration for various situations
This commit is contained in:
parent
79ab75fc90
commit
bff8b9d6ad
1 changed files with 3 additions and 3 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
import pickle
|
import pickle
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import evennia.utils.picklefield
|
import evennia.utils.picklefield
|
||||||
from evennia.utils.utils import to_bytes
|
from evennia.utils.utils import to_bytes, to_str
|
||||||
|
|
||||||
def migrate_serverconf(apps, schema_editor):
|
def migrate_serverconf(apps, schema_editor):
|
||||||
"""
|
"""
|
||||||
|
|
@ -13,8 +13,8 @@ def migrate_serverconf(apps, schema_editor):
|
||||||
ServerConfig = apps.get_model("server", "ServerConfig")
|
ServerConfig = apps.get_model("server", "ServerConfig")
|
||||||
for conf in ServerConfig.objects.all():
|
for conf in ServerConfig.objects.all():
|
||||||
value = pickle.loads(to_bytes(conf.db_value))
|
value = pickle.loads(to_bytes(conf.db_value))
|
||||||
conf.db_value2 = value
|
conf.db_value2 = to_str(value)
|
||||||
conf.save()
|
conf.save(update_fields=["db_value2"])
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue