Revert migration name change - it's irrelevant for this point in git history

This commit is contained in:
Griatch 2017-09-07 21:42:55 +02:00
parent f6b4155aed
commit 3c1544ca16
3 changed files with 47 additions and 43 deletions

View file

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-05 17:36
from __future__ import unicode_literals
from django.db import migrations
# This migration only made sense earlier in the git history, during
# the player->account transition. Now it will do nothing since players.PlayerDB
# no longer exists.
def forwards(apps, schema_editor):
try:
apps.get_model('players', 'PlayerDB')
except LookupError:
return
AccountDB = apps.get_model('accounts', 'AccountDB')
Msg = apps.get_model('comms', 'Msg')
for msg in Msg.objects.all():
for player in msg.db_sender_players.all():
account = AccountDB.objects.get(id=player.id)
msg.db_sender_accounts.add(account)
for player in msg.db_receivers_players.all():
account = AccountDB.objects.get(id=player.id)
msg.db_receivers_accounts.add(account)
for player in msg.db_hide_from_players.all():
account = AccountDB.objects.get(id=player.id)
msg.db_hide_from_accounts.add(account)
ChannelDB = apps.get_model('comms', 'ChannelDB')
for channel in ChannelDB.objects.all():
for player in channel.db_subscriptions.all():
account = AccountDB.objects.get(id=player.id)
channel.db_account_subscriptions.add(player)
class Migration(migrations.Migration):
dependencies = [
('comms', '0013_auto_20170705_1726'),
]
operations = [
migrations.RunPython(forwards)
]

View file

@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-05 17:36
from __future__ import unicode_literals
from django.db import migrations
def forwards(apps, schema_editor):
try:
AccountDB = apps.get_model('accounts', 'AccountDB')
except LookupError:
return
Msg = apps.get_model('comms', 'Msg')
for msg in Msg.objects.all():
for account in msg.db_sender_accounts.all():
account = AccountDB.objects.get(id=account.id)
msg.db_sender_accounts.add(account)
for account in msg.db_receivers_accounts.all():
account = AccountDB.objects.get(id=account.id)
msg.db_receivers_accounts.add(account)
for account in msg.db_hide_from_accounts.all():
account = AccountDB.objects.get(id=account.id)
msg.db_hide_from_accounts.add(account)
ChannelDB = apps.get_model('comms', 'ChannelDB')
for channel in ChannelDB.objects.all():
for account in channel.db_subscriptions.all():
account = AccountDB.objects.get(id=account.id)
channel.db_account_subscriptions.add(account)
class Migration(migrations.Migration):
dependencies = [
('comms', '0013_auto_20170705_1726'),
]
operations = [
migrations.RunPython(forwards)
]

View file

@ -18,7 +18,7 @@ def _table_exists(db_cursor, tablename):
class Migration(migrations.Migration):
dependencies = [
('comms', '0014_convert_msgs_may_be_slow'),
('comms', '0014_auto_20170705_1736'),
]
db_cursor = connection.cursor()