mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Run migrations! Some first auto-migrations
Stepped back some more ambitious migrations since they caused all sorts of issues with bytes/str conversions.
This commit is contained in:
parent
bff8b9d6ad
commit
54e7376b31
5 changed files with 27 additions and 61 deletions
|
|
@ -83,6 +83,10 @@ Web/Django standard initiative (@strikaco)
|
|||
|
||||
- Added more unit tests.
|
||||
|
||||
### Server
|
||||
|
||||
- Convert ServerConf model to store its values as a Picklefield (same as Attributes) instead of using a custom solution.
|
||||
|
||||
### Utils
|
||||
|
||||
- Swap argument order of `evennia.set_trace` to `set_trace(term_size=(140, 40), debugger='auto')`
|
||||
|
|
@ -95,6 +99,7 @@ Web/Django standard initiative (@strikaco)
|
|||
str to bytes.
|
||||
|
||||
|
||||
|
||||
## Evennia 0.8 (2018)
|
||||
|
||||
### Requirements
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.16 on 2019-01-28 18:20
|
||||
|
||||
import pickle
|
||||
from django.db import migrations, models
|
||||
import evennia.utils.picklefield
|
||||
from evennia.utils.utils import to_bytes, to_str
|
||||
|
||||
def migrate_serverconf(apps, schema_editor):
|
||||
"""
|
||||
Move server conf from a custom binary field into a PickleObjectField
|
||||
"""
|
||||
ServerConfig = apps.get_model("server", "ServerConfig")
|
||||
for conf in ServerConfig.objects.all():
|
||||
value = pickle.loads(to_bytes(conf.db_value))
|
||||
conf.db_value2 = to_str(value)
|
||||
conf.save(update_fields=["db_value2"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('server', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='serverconfig',
|
||||
name='db_value2',
|
||||
field=evennia.utils.picklefield.PickledObjectField(help_text='The data returned when the config value is accessed. Must be written as a Python literal if editing through the admin interface. Attribute values which are not Python literals cannot be edited through the admin interface.', null=True, verbose_name='value'),
|
||||
),
|
||||
# migrate data
|
||||
migrations.RunPython(migrate_serverconf, migrations.RunPython.noop),
|
||||
|
||||
|
||||
]
|
||||
21
evennia/server/migrations/0002_auto_20190128_2311.py
Normal file
21
evennia/server/migrations/0002_auto_20190128_2311.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.16 on 2019-01-28 23:11
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
import evennia.utils.picklefield
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('server', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='serverconfig',
|
||||
name='db_value',
|
||||
field=evennia.utils.picklefield.PickledObjectField(help_text='The data returned when the config value is accessed. Must be written as a Python literal if editing through the admin interface. Attribute values which are not Python literals cannot be edited through the admin interface.', null=True, verbose_name='value'),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.16 on 2019-01-28 18:43
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('server', '0002_auto_20190128_1820'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='serverconfig',
|
||||
name='db_value',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='serverconfig',
|
||||
old_name='db_value2',
|
||||
new_name='db_value',
|
||||
),
|
||||
]
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
"""
|
||||
Pickle field implementation for Django.
|
||||
|
||||
Modified for Evennia by Griatch.
|
||||
Modified for Evennia by Griatch and the Evennia community.
|
||||
|
||||
"""
|
||||
from builtins import object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue