Rename migrations to depend on account-migrations instead of players

This commit is contained in:
Griatch 2017-07-09 09:12:09 +02:00
parent 120ddb7f81
commit a7aa1215cb
18 changed files with 62 additions and 62 deletions

View file

@ -20,7 +20,7 @@ class Migration(migrations.Migration):
('db_typeclass_path', models.CharField(help_text=b"this defines what 'type' of entity this is. This variable holds a Python path to a module with a valid Evennia Typeclass.", max_length=255, null=True, verbose_name=b'typeclass')),
('db_date_created', models.DateTimeField(auto_now_add=True, verbose_name=b'creation date')),
('db_lock_storage', models.TextField(help_text=b"locks limit access to an entity. A lock is defined as a 'lock string' on the form 'type:lockfunctions', defining what functionality is locked and how to determine access. Not defining a lock means no access is granted.", verbose_name=b'locks', blank=True)),
('db_sessid', models.CommaSeparatedIntegerField(help_text=b'csv list of session ids of connected Player, if any.', max_length=32, null=True, verbose_name=b'session id')),
('db_sessid', models.CommaSeparatedIntegerField(help_text=b'csv list of session ids of connected Account, if any.', max_length=32, null=True, verbose_name=b'session id')),
('db_cmdset_storage', models.CharField(help_text=b'optional python path to a cmdset class.', max_length=255, null=True, verbose_name=b'cmdset', blank=True)),
('db_attributes', models.ManyToManyField(help_text=b'attributes on this object. An attribute can hold any pickle-able python object (see docs for special cases).', to='typeclasses.Attribute', null=True)),
('db_destination', models.ForeignKey(related_name=b'destinations_set', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='objects.ObjectDB', help_text=b'a destination, used only by exit objects.', null=True, verbose_name=b'destination')),

View file

@ -17,8 +17,8 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name='objectdb',
name='db_player',
field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, verbose_name=b'player', to=settings.AUTH_USER_MODEL, help_text=b'a Player connected to this object, if any.', null=True),
name='db_account',
field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, verbose_name=b'account', to=settings.AUTH_USER_MODEL, help_text=b'an Account connected to this object, if any.', null=True),
preserve_default=True,
),
migrations.AddField(

View file

@ -22,7 +22,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='objectdb',
name='db_sessid',
field=models.CharField(help_text=b'csv list of session ids of connected Player, if any.', max_length=32, null=True, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:\\,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')], verbose_name=b'session id'),
field=models.CharField(help_text=b'csv list of session ids of connected Account, if any.', max_length=32, null=True, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:\\,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')], verbose_name=b'session id'),
),
migrations.AlterField(
model_name='objectdb',

View file

@ -8,16 +8,16 @@ from django.db import migrations
def forwards(apps, schema_editor):
try:
apps.get_model('players', 'PlayerDB')
apps.get_model('accounts', 'AccountDB')
except LookupError:
return
AccountDB = apps.get_model('accounts', 'AccountDB')
ObjectDB = apps.get_model('objects', 'ObjectDB')
for object in ObjectDB.objects.all():
player = object.db_player
if player:
account = AccountDB.objects.get(id=player.id)
account = object.db_account
if account:
account = AccountDB.objects.get(id=account.id)
object.db_account = account
object.save(update_fields=['db_account'])

View file

@ -14,6 +14,6 @@ class Migration(migrations.Migration):
operations = [
migrations.RemoveField(
model_name='objectdb',
name='db_player',
name='db_account',
),
]