mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 02:06:32 +01:00
Run Migrations! Converts attributes to use pickle v4
This commit is contained in:
parent
a2ddc82707
commit
1738006dce
1 changed files with 29 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.16 on 2019-01-30 20:56
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from copy import deepcopy
|
||||
from base64 import b64encode, b64decode
|
||||
from django.db import migrations
|
||||
from pickle import dumps, loads
|
||||
from evennia.utils.utils import to_bytes
|
||||
|
||||
|
||||
def forwards(apps, schema_editor):
|
||||
Attribute = apps.get_model('typeclasses', 'Attribute')
|
||||
for attr in Attribute.objects.all():
|
||||
# we need to re-assign the Attribute it's own value to make sure pickle switches from v2 to v4,
|
||||
# otherwise we will not be able to search db by-value.
|
||||
attr.db_value = attr.db_value
|
||||
attr.save(update_fields=["db_value"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('typeclasses', '0011_auto_20190128_1820'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(forwards, migrations.RunPython.noop),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue