diff --git a/evennia/typeclasses/migrations/0006_auto_20170121_2230.py b/evennia/typeclasses/migrations/0006_auto_20170121_2230.py deleted file mode 100644 index 9db98e5cbe..0000000000 --- a/evennia/typeclasses/migrations/0006_auto_20170121_2230.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.11 on 2017-01-21 22:30 -from __future__ import unicode_literals - -from django.db import migrations - -def update_tags_with_dbmodel(apps, schema_editor): - Tag = apps.get_model('typeclasses', 'Tag') - Attribute = apps.get_model('typeclasses', 'Attribute') - ObjectDB = apps.get_model('objects', 'ObjectDB') - PlayerDB = apps.get_model('players', 'PlayerDB') - ScriptDB = apps.get_model('scripts', 'ScriptDB') - HelpEntry = apps.get_model('help', 'HelpEntry') - Msg = apps.get_model('comms', 'Msg') - - - - - -class Migration(migrations.Migration): - - dependencies = [ - ('typeclasses', '0005_auto_20160625_1812'), - ] - - operations = [ - migrations.RunPython(update_tags_with_dbmodel) - ] diff --git a/evennia/typeclasses/migrations/0006_auto_add_dbmodel_value_for_tags_attributes.py b/evennia/typeclasses/migrations/0006_auto_add_dbmodel_value_for_tags_attributes.py new file mode 100644 index 0000000000..f68ac4cf84 --- /dev/null +++ b/evennia/typeclasses/migrations/0006_auto_add_dbmodel_value_for_tags_attributes.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.11 on 2017-01-21 22:30 +from __future__ import unicode_literals + +from django.db import migrations + +def update_tags_with_dbmodel(apps, schema_editor): + + ObjectDB = apps.get_model('objects', 'ObjectDB') + for obj in ObjectDB.objects.all(): + obj.db_attributes.all().update(db_model="objectdb") + obj.db_tags.all().update(db_model="objectdb") + + PlayerDB = apps.get_model('players', 'PlayerDB') + for obj in PlayerDB.objects.all(): + obj.db_attributes.all().update(db_model="playerdb") + obj.db_tags.all().update(db_model="playerdb") + + ScriptDB = apps.get_model('scripts', 'ScriptDB') + for obj in ScriptDB.objects.all(): + obj.db_attributes.all().update(db_model="scriptdb") + obj.db_tags.all().update(db_model="scriptdb") + + ChannelDB = apps.get_model('comms', 'ChannelDB') + for obj in ChannelDB.objects.all(): + obj.db_attributes.all().update(db_model="channeldb") + obj.db_tags.all().update(db_model="channeldb") + + HelpEntry = apps.get_model('help', 'HelpEntry') + for obj in HelpEntry.objects.all(): + obj.db_tags.all().update(db_model="helpentry") + + Msg = apps.get_model('comms', 'Msg') + for obj in Msg.objects.all(): + obj.db_tags.all().update(db_model="msg") + + +class Migration(migrations.Migration): + + dependencies = [ + ('typeclasses', '0005_auto_20160625_1812'), + ] + + operations = [ + migrations.RunPython(update_tags_with_dbmodel) + ]