From e10a82060dcf22332328ceef972da9f16fe7ab91 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Sat, 7 Apr 2018 15:39:17 +0200
Subject: [PATCH] Ensure we delete existing actors to reset private and public
 keys

---
 .../federation/migrations/0003_auto_20180407_1010.py  | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/api/funkwhale_api/federation/migrations/0003_auto_20180407_1010.py b/api/funkwhale_api/federation/migrations/0003_auto_20180407_1010.py
index 38ac7cb4..12e3d73f 100644
--- a/api/funkwhale_api/federation/migrations/0003_auto_20180407_1010.py
+++ b/api/funkwhale_api/federation/migrations/0003_auto_20180407_1010.py
@@ -7,6 +7,16 @@ import django.utils.timezone
 import uuid
 
 
+def delete_system_actors(apps, schema_editor):
+    """Revert site domain and name to default."""
+    Actor = apps.get_model("federation", "Actor")
+    Actor.objects.filter(preferred_username__in=['test', 'library']).delete()
+
+
+def backward(apps, schema_editor):
+    pass
+
+
 class Migration(migrations.Migration):
 
     dependencies = [
@@ -14,6 +24,7 @@ class Migration(migrations.Migration):
     ]
 
     operations = [
+        migrations.RunPython(delete_system_actors, backward),
         migrations.CreateModel(
             name='Follow',
             fields=[
-- 
GitLab