Skip to content

Commit aba593b

Browse files
author
Nik Sauer
committed
#108 reset organization of all campaings to none
1 parent 6ae66c9 commit aba593b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/campaign/migrations/0009_remove_organization_owner_remove_organization_users_and_more.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
from django.db import migrations, models
55

66

7+
def set_invalid_foreign_keys_to_null(apps, schema_editor):
8+
Campaign = apps.get_model('campaign', 'Campaign')
9+
for campaign in Campaign.objects.all():
10+
campaign.organization = None
11+
campaign.save()
12+
13+
714
class Migration(migrations.Migration):
815

916
dependencies = [
@@ -13,6 +20,7 @@ class Migration(migrations.Migration):
1320
]
1421

1522
operations = [
23+
migrations.RunPython(set_invalid_foreign_keys_to_null),
1624
migrations.RemoveField(
1725
model_name='organization',
1826
name='owner',

0 commit comments

Comments
 (0)