Rename migrations to depend on account-migrations instead of players
This commit is contained in:
parent
120ddb7f81
commit
a7aa1215cb
18 changed files with 62 additions and 62 deletions
|
|
@ -30,7 +30,7 @@ class Migration(migrations.Migration):
|
|||
('db_is_active', models.BooleanField(default=False, verbose_name=b'script active')),
|
||||
('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_obj', models.ForeignKey(blank=True, to='objects.ObjectDB', help_text=b'the object to store this script on, if not a global script.', null=True, verbose_name=b'scripted object')),
|
||||
('db_player', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, help_text=b'the player to store this script on (should not be set if obj is set)', null=True, verbose_name=b'scripted player')),
|
||||
('db_account', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, help_text=b'the account to store this script on (should not be set if obj is set)', null=True, verbose_name=b'scripted account')),
|
||||
('db_tags', models.ManyToManyField(help_text=b'tags on this object. Tags are simple string markers to identify, group and alias objects.', to='typeclasses.Tag', null=True)),
|
||||
],
|
||||
options={
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
ScriptDB = apps.get_model('scripts', 'ScriptDB')
|
||||
|
||||
for script in ScriptDB.objects.all():
|
||||
player = script.db_player
|
||||
if player:
|
||||
account = AccountDB.objects.get(id=player.id)
|
||||
account = script.db_account
|
||||
if account:
|
||||
account = AccountDB.objects.get(id=account.id)
|
||||
script.db_account = account
|
||||
script.save(update_fields=['db_account'])
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@ class Migration(migrations.Migration):
|
|||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='scriptdb',
|
||||
name='db_player',
|
||||
name='db_account',
|
||||
),
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue