From 3c1544ca16b119d20a85202a67affe2a7f4b9234 Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 7 Sep 2017 21:42:55 +0200 Subject: [PATCH] Revert migration name change - it's irrelevant for this point in git history --- .../migrations/0014_auto_20170705_1736.py | 46 +++++++++++++++++++ .../0014_convert_msgs_may_be_slow.py | 42 ----------------- .../migrations/0015_auto_20170706_2041.py | 2 +- 3 files changed, 47 insertions(+), 43 deletions(-) create mode 100644 evennia/comms/migrations/0014_auto_20170705_1736.py delete mode 100644 evennia/comms/migrations/0014_convert_msgs_may_be_slow.py diff --git a/evennia/comms/migrations/0014_auto_20170705_1736.py b/evennia/comms/migrations/0014_auto_20170705_1736.py new file mode 100644 index 0000000000..474f4b13d6 --- /dev/null +++ b/evennia/comms/migrations/0014_auto_20170705_1736.py @@ -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) + ] diff --git a/evennia/comms/migrations/0014_convert_msgs_may_be_slow.py b/evennia/comms/migrations/0014_convert_msgs_may_be_slow.py deleted file mode 100644 index cb5f165445..0000000000 --- a/evennia/comms/migrations/0014_convert_msgs_may_be_slow.py +++ /dev/null @@ -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) - ] diff --git a/evennia/comms/migrations/0015_auto_20170706_2041.py b/evennia/comms/migrations/0015_auto_20170706_2041.py index a9e2083a83..607cabef29 100644 --- a/evennia/comms/migrations/0015_auto_20170706_2041.py +++ b/evennia/comms/migrations/0015_auto_20170706_2041.py @@ -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()