mirror of
https://github.com/evennia/evennia.git
synced 2026-03-24 08:46:31 +01:00
Fixed a regression in the install process with south.
This commit is contained in:
parent
f68523cc22
commit
7995c91eee
1 changed files with 10 additions and 6 deletions
|
|
@ -4,21 +4,25 @@ from south.db import db
|
|||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
from src.objects.models import ObjectDB
|
||||
from south import orm
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
|
||||
# Adding field 'ObjectDB.db_destination'
|
||||
db.add_column('objects_objectdb', 'db_destination', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='destinations_set', null=True, to=orm['objects.ObjectDB']), keep_default=False)
|
||||
|
||||
# move all exits to the new property
|
||||
for exi in ObjectDB.objects.get_objs_with_attr('_destination'):
|
||||
exi.destination = exi.db._destination
|
||||
exi.del_attribute('_destination')
|
||||
#move all exits to the new property
|
||||
if not db.dry_run:
|
||||
#for exi in ObjectDB.objects.get_objs_with_attr('_destination'):
|
||||
#for exi in orm["objects.ObjAttribute"].objects.get_objs_with_attr('_destination'):
|
||||
for exi in orm["objects.ObjAttribute"].objects.select_related("db_obj").filter(db_key="_destination").values_list('db_obj'):
|
||||
exi.destination = exi.db._destination
|
||||
exi.del_attribute('_destination')
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
|
||||
# Deleting field 'ObjectDB.db_destination'
|
||||
db.delete_column('objects_objectdb', 'db_destination_id')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue