From 3cb306bc91103b519359360899c461d7a6db86f8 Mon Sep 17 00:00:00 2001 From: Bartuccio Antoine Date: Sun, 6 Oct 2019 00:32:54 +0200 Subject: [PATCH] django2.2: add on_delete on migrations for ForeignKey --- accounting/migrations/0001_initial.py | 3 ++ .../migrations/0002_auto_20160824_2152.py | 16 +++++++- .../migrations/0004_auto_20161005_1505.py | 1 + club/migrations/0001_initial.py | 6 ++- club/migrations/0002_auto_20160824_2152.py | 13 +++++- club/migrations/0004_auto_20160915_1057.py | 2 + club/migrations/0009_auto_20170822_2232.py | 9 +++- club/migrations/0011_auto_20180426_2013.py | 2 + com/migrations/0002_news_newsdate.py | 13 +++++- com/migrations/0003_auto_20170115_2300.py | 4 ++ com/migrations/0004_auto_20171221_1614.py | 7 +++- core/migrations/0001_initial.py | 17 +++++++- core/migrations/0005_auto_20161105_1035.py | 2 + core/migrations/0012_notification.py | 5 ++- core/migrations/0015_sithfile_moderator.py | 2 + core/migrations/0016_auto_20161212_1922.py | 2 + core/migrations/0027_gift.py | 5 ++- core/migrations/0029_auto_20180426_2013.py | 2 + counter/migrations/0001_initial.py | 36 +++++++++++++--- counter/migrations/0002_auto_20160826_1342.py | 6 +++ counter/migrations/0005_auto_20160826_2330.py | 6 ++- eboutic/migrations/0001_initial.py | 9 +++- election/migrations/0001_initial.py | 15 ++++++- forum/migrations/0001_initial.py | 41 +++++++++++++++---- launderette/migrations/0001_initial.py | 11 ++++- sas/migrations/0002_auto_20161119_1241.py | 7 +++- stock/migrations/0001_initial.py | 16 ++++++-- subscription/migrations/0001_initial.py | 7 +++- trombi/migrations/0001_initial.py | 2 + .../migrations/0004_trombiclubmembership.py | 2 + 30 files changed, 233 insertions(+), 36 deletions(-) diff --git a/accounting/migrations/0001_initial.py b/accounting/migrations/0001_initial.py index 9bd829a6..0196d3f2 100644 --- a/accounting/migrations/0001_initial.py +++ b/accounting/migrations/0001_initial.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.core.validators import accounting.models +import django.db.models.deletion class Migration(migrations.Migration): @@ -243,6 +244,7 @@ class Migration(migrations.Migration): verbose_name="accounting type", to="accounting.AccountingType", blank=True, + on_delete=django.db.models.deletion.CASCADE, ), ), ], @@ -267,6 +269,7 @@ class Migration(migrations.Migration): verbose_name="simplified accounting types", to="accounting.AccountingType", related_name="simplified_types", + on_delete=django.db.models.deletion.CASCADE, ), ), ], diff --git a/accounting/migrations/0002_auto_20160824_2152.py b/accounting/migrations/0002_auto_20160824_2152.py index e0322f08..9c7458e4 100644 --- a/accounting/migrations/0002_auto_20160824_2152.py +++ b/accounting/migrations/0002_auto_20160824_2152.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -22,6 +23,7 @@ class Migration(migrations.Migration): verbose_name="invoice", to="core.SithFile", blank=True, + on_delete=django.db.models.deletion.CASCADE, ), ), migrations.AddField( @@ -31,6 +33,7 @@ class Migration(migrations.Migration): verbose_name="journal", to="accounting.GeneralJournal", related_name="operations", + on_delete=django.db.models.deletion.CASCADE, ), ), migrations.AddField( @@ -54,6 +57,7 @@ class Migration(migrations.Migration): verbose_name="simple type", to="accounting.SimplifiedAccountingType", blank=True, + on_delete=django.db.models.deletion.CASCADE, ), ), migrations.AddField( @@ -63,6 +67,7 @@ class Migration(migrations.Migration): verbose_name="club account", to="accounting.ClubAccount", related_name="journals", + on_delete=django.db.models.deletion.CASCADE, ), ), migrations.AddField( @@ -72,20 +77,27 @@ class Migration(migrations.Migration): verbose_name="bank account", to="accounting.BankAccount", related_name="club_accounts", + on_delete=django.db.models.deletion.CASCADE, ), ), migrations.AddField( model_name="clubaccount", name="club", field=models.ForeignKey( - verbose_name="club", to="club.Club", related_name="club_account" + verbose_name="club", + to="club.Club", + related_name="club_account", + on_delete=django.db.models.deletion.CASCADE, ), ), migrations.AddField( model_name="bankaccount", name="club", field=models.ForeignKey( - verbose_name="club", to="club.Club", related_name="bank_accounts" + verbose_name="club", + to="club.Club", + related_name="bank_accounts", + on_delete=django.db.models.deletion.CASCADE, ), ), migrations.AlterUniqueTogether( diff --git a/accounting/migrations/0004_auto_20161005_1505.py b/accounting/migrations/0004_auto_20161005_1505.py index c363cddb..8fe3a472 100644 --- a/accounting/migrations/0004_auto_20161005_1505.py +++ b/accounting/migrations/0004_auto_20161005_1505.py @@ -29,6 +29,7 @@ class Migration(migrations.Migration): related_name="labels", verbose_name="club account", to="accounting.ClubAccount", + on_delete=django.db.models.deletion.CASCADE, ), ), ], diff --git a/club/migrations/0001_initial.py b/club/migrations/0001_initial.py index 0bc1ec7e..17d3f309 100644 --- a/club/migrations/0001_initial.py +++ b/club/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.core.validators +import django.db.models.deletion class Migration(migrations.Migration): @@ -90,7 +91,10 @@ class Migration(migrations.Migration): ( "club", models.ForeignKey( - verbose_name="club", to="club.Club", related_name="members" + verbose_name="club", + to="club.Club", + related_name="members", + on_delete=django.db.models.deletion.CASCADE, ), ), ], diff --git a/club/migrations/0002_auto_20160824_2152.py b/club/migrations/0002_auto_20160824_2152.py index b6de6b01..3d678866 100644 --- a/club/migrations/0002_auto_20160824_2152.py +++ b/club/migrations/0002_auto_20160824_2152.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -18,6 +19,7 @@ class Migration(migrations.Migration): model_name="membership", name="user", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="user", to=settings.AUTH_USER_MODEL, related_name="membership", @@ -45,14 +47,21 @@ class Migration(migrations.Migration): model_name="club", name="owner_group", field=models.ForeignKey( - default=1, to="core.Group", related_name="owned_club" + on_delete=django.db.models.deletion.CASCADE, + default=1, + to="core.Group", + related_name="owned_club", ), ), migrations.AddField( model_name="club", name="parent", field=models.ForeignKey( - null=True, to="club.Club", related_name="children", blank=True + on_delete=django.db.models.deletion.CASCADE, + null=True, + to="club.Club", + related_name="children", + blank=True, ), ), migrations.AddField( diff --git a/club/migrations/0004_auto_20160915_1057.py b/club/migrations/0004_auto_20160915_1057.py index 6cdde0a6..15fc00de 100644 --- a/club/migrations/0004_auto_20160915_1057.py +++ b/club/migrations/0004_auto_20160915_1057.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -14,6 +15,7 @@ class Migration(migrations.Migration): model_name="membership", name="user", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="user", related_name="memberships", to=settings.AUTH_USER_MODEL, diff --git a/club/migrations/0009_auto_20170822_2232.py b/club/migrations/0009_auto_20170822_2232.py index a7d84c3a..18fcd3c6 100644 --- a/club/migrations/0009_auto_20170822_2232.py +++ b/club/migrations/0009_auto_20170822_2232.py @@ -5,6 +5,7 @@ from django.db import migrations, models from django.conf import settings import re import django.core.validators +import django.db.models.deletion class Migration(migrations.Migration): @@ -51,12 +52,16 @@ class Migration(migrations.Migration): ( "club", models.ForeignKey( - verbose_name="Club", related_name="mailings", to="club.Club" + on_delete=django.db.models.deletion.CASCADE, + verbose_name="Club", + related_name="mailings", + to="club.Club", ), ), ( "moderator", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, null=True, verbose_name="moderator", related_name="moderated_mailings", @@ -84,6 +89,7 @@ class Migration(migrations.Migration): ( "mailing", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="Mailing", related_name="subscriptions", to="club.Mailing", @@ -92,6 +98,7 @@ class Migration(migrations.Migration): ( "user", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, null=True, verbose_name="User", related_name="mailing_subscriptions", diff --git a/club/migrations/0011_auto_20180426_2013.py b/club/migrations/0011_auto_20180426_2013.py index 8d63136e..74ca6fd0 100644 --- a/club/migrations/0011_auto_20180426_2013.py +++ b/club/migrations/0011_auto_20180426_2013.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models import club.models +import django.db.models.deletion class Migration(migrations.Migration): @@ -14,6 +15,7 @@ class Migration(migrations.Migration): model_name="club", name="owner_group", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, default=club.models.Club.get_default_owner_group, related_name="owned_club", to="core.Group", diff --git a/com/migrations/0002_news_newsdate.py b/com/migrations/0002_news_newsdate.py index 27241539..026d949c 100644 --- a/com/migrations/0002_news_newsdate.py +++ b/com/migrations/0002_news_newsdate.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -50,6 +51,7 @@ class Migration(migrations.Migration): ( "author", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="owned_news", to=settings.AUTH_USER_MODEL, verbose_name="author", @@ -58,12 +60,16 @@ class Migration(migrations.Migration): ( "club", models.ForeignKey( - related_name="news", to="club.Club", verbose_name="club" + on_delete=django.db.models.deletion.CASCADE, + related_name="news", + to="club.Club", + verbose_name="club", ), ), ( "moderator", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="moderated_news", null=True, to=settings.AUTH_USER_MODEL, @@ -99,7 +105,10 @@ class Migration(migrations.Migration): ( "news", models.ForeignKey( - related_name="dates", to="com.News", verbose_name="news_date" + on_delete=django.db.models.deletion.CASCADE, + related_name="dates", + to="com.News", + verbose_name="news_date", ), ), ], diff --git a/com/migrations/0003_auto_20170115_2300.py b/com/migrations/0003_auto_20170115_2300.py index d8fd9771..6ca595e5 100644 --- a/com/migrations/0003_auto_20170115_2300.py +++ b/com/migrations/0003_auto_20170115_2300.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -56,6 +57,7 @@ class Migration(migrations.Migration): ( "author", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name="author", related_name="owned_weekmail_articles", @@ -64,6 +66,7 @@ class Migration(migrations.Migration): ( "club", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="club.Club", verbose_name="club", related_name="weekmail_articles", @@ -72,6 +75,7 @@ class Migration(migrations.Migration): ( "weekmail", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="com.Weekmail", verbose_name="weekmail", related_name="articles", diff --git a/com/migrations/0004_auto_20171221_1614.py b/com/migrations/0004_auto_20171221_1614.py index 1ebd9b86..853f810a 100644 --- a/com/migrations/0004_auto_20171221_1614.py +++ b/com/migrations/0004_auto_20171221_1614.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -48,12 +49,16 @@ class Migration(migrations.Migration): ( "club", models.ForeignKey( - verbose_name="club", related_name="posters", to="club.Club" + on_delete=django.db.models.deletion.CASCADE, + verbose_name="club", + related_name="posters", + to="club.Club", ), ), ( "moderator", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="moderator", blank=True, null=True, diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py index 190ace89..903b9b77 100644 --- a/core/migrations/0001_initial.py +++ b/core/migrations/0001_initial.py @@ -8,6 +8,7 @@ import django.core.validators import core.models import phonenumber_field.modelfields from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -329,6 +330,7 @@ class Migration(migrations.Migration): ( "owner_group", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, default=1, related_name="owned_page", verbose_name="owner group", @@ -390,10 +392,19 @@ class Migration(migrations.Migration): ( "author", models.ForeignKey( - to=settings.AUTH_USER_MODEL, related_name="page_rev" + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + related_name="page_rev", + ), + ), + ( + "page", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="core.Page", + related_name="revisions", ), ), - ("page", models.ForeignKey(to="core.Page", related_name="revisions")), ], options={"ordering": ["date"]}, ), @@ -469,6 +480,7 @@ class Migration(migrations.Migration): ( "owner", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="owner", to=settings.AUTH_USER_MODEL, related_name="owned_files", @@ -477,6 +489,7 @@ class Migration(migrations.Migration): ( "parent", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, null=True, related_name="children", verbose_name="parent", diff --git a/core/migrations/0005_auto_20161105_1035.py b/core/migrations/0005_auto_20161105_1035.py index 803b373a..5225f184 100644 --- a/core/migrations/0005_auto_20161105_1035.py +++ b/core/migrations/0005_auto_20161105_1035.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -21,6 +22,7 @@ class Migration(migrations.Migration): model_name="page", name="lock_user", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="lock user", default=None, blank=True, diff --git a/core/migrations/0012_notification.py b/core/migrations/0012_notification.py index f48e4063..a7a68209 100644 --- a/core/migrations/0012_notification.py +++ b/core/migrations/0012_notification.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings import django.utils.timezone +import django.db.models.deletion class Migration(migrations.Migration): @@ -48,7 +49,9 @@ class Migration(migrations.Migration): ( "user", models.ForeignKey( - related_name="notifications", to=settings.AUTH_USER_MODEL + on_delete=django.db.models.deletion.CASCADE, + related_name="notifications", + to=settings.AUTH_USER_MODEL, ), ), ], diff --git a/core/migrations/0015_sithfile_moderator.py b/core/migrations/0015_sithfile_moderator.py index 00e2f1f9..13e6a3f2 100644 --- a/core/migrations/0015_sithfile_moderator.py +++ b/core/migrations/0015_sithfile_moderator.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -14,6 +15,7 @@ class Migration(migrations.Migration): model_name="sithfile", name="moderator", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="moderated_files", verbose_name="owner", default=0, diff --git a/core/migrations/0016_auto_20161212_1922.py b/core/migrations/0016_auto_20161212_1922.py index e98f06d6..f23b0dd5 100644 --- a/core/migrations/0016_auto_20161212_1922.py +++ b/core/migrations/0016_auto_20161212_1922.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -14,6 +15,7 @@ class Migration(migrations.Migration): model_name="sithfile", name="moderator", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="moderated_files", blank=True, null=True, diff --git a/core/migrations/0027_gift.py b/core/migrations/0027_gift.py index bfac2175..ab342e26 100644 --- a/core/migrations/0027_gift.py +++ b/core/migrations/0027_gift.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings import django.utils.timezone +import django.db.models.deletion class Migration(migrations.Migration): @@ -33,7 +34,9 @@ class Migration(migrations.Migration): ( "user", models.ForeignKey( - related_name="gifts", to=settings.AUTH_USER_MODEL + on_delete=django.db.models.deletion.CASCADE, + related_name="gifts", + to=settings.AUTH_USER_MODEL, ), ), ], diff --git a/core/migrations/0029_auto_20180426_2013.py b/core/migrations/0029_auto_20180426_2013.py index 4f80245d..ac0a06be 100644 --- a/core/migrations/0029_auto_20180426_2013.py +++ b/core/migrations/0029_auto_20180426_2013.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models import core.models +import django.db.models.deletion class Migration(migrations.Migration): @@ -14,6 +15,7 @@ class Migration(migrations.Migration): model_name="page", name="owner_group", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="owner group", default=core.models.Page.get_default_owner_group, related_name="owned_page", diff --git a/counter/migrations/0001_initial.py b/counter/migrations/0001_initial.py index 06f01d59..dcbcf574 100644 --- a/counter/migrations/0001_initial.py +++ b/counter/migrations/0001_initial.py @@ -5,6 +5,7 @@ from django.db import migrations, models import accounting.models import django.db.models.deletion from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -42,7 +43,14 @@ class Migration(migrations.Migration): verbose_name="counter type", ), ), - ("club", models.ForeignKey(to="club.Club", related_name="counters")), + ( + "club", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="club.Club", + related_name="counters", + ), + ), ( "edit_groups", models.ManyToManyField( @@ -97,13 +105,17 @@ class Migration(migrations.Migration): ( "counter", models.ForeignKey( - to="counter.Counter", related_name="permanencies" + on_delete=django.db.models.deletion.CASCADE, + to="counter.Counter", + related_name="permanencies", ), ), ( "user", models.ForeignKey( - to=settings.AUTH_USER_MODEL, related_name="permanencies" + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + related_name="permanencies", ), ), ], @@ -169,7 +181,10 @@ class Migration(migrations.Migration): ( "club", models.ForeignKey( - verbose_name="club", to="club.Club", related_name="products" + on_delete=django.db.models.deletion.CASCADE, + verbose_name="club", + to="club.Club", + related_name="products", ), ), ( @@ -268,15 +283,24 @@ class Migration(migrations.Migration): ), ( "counter", - models.ForeignKey(to="counter.Counter", related_name="refillings"), + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="counter.Counter", + related_name="refillings", + ), ), ( "customer", - models.ForeignKey(to="counter.Customer", related_name="refillings"), + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="counter.Customer", + related_name="refillings", + ), ), ( "operator", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, related_name="refillings_as_operator", ), diff --git a/counter/migrations/0002_auto_20160826_1342.py b/counter/migrations/0002_auto_20160826_1342.py index 721f5c8e..9b97700e 100644 --- a/counter/migrations/0002_auto_20160826_1342.py +++ b/counter/migrations/0002_auto_20160826_1342.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings import accounting.models +import django.db.models.deletion class Migration(migrations.Migration): @@ -35,6 +36,7 @@ class Migration(migrations.Migration): ( "counter", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="counter.Counter", related_name="cash_summaries", verbose_name="counter", @@ -43,6 +45,7 @@ class Migration(migrations.Migration): ( "user", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, related_name="cash_summaries", verbose_name="user", @@ -74,6 +77,7 @@ class Migration(migrations.Migration): ( "cash_summary", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="counter.CashRegisterSummary", related_name="items", verbose_name="cash summary", @@ -86,6 +90,7 @@ class Migration(migrations.Migration): model_name="permanency", name="counter", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="counter.Counter", related_name="permanencies", verbose_name="counter", @@ -95,6 +100,7 @@ class Migration(migrations.Migration): model_name="permanency", name="user", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, related_name="permanencies", verbose_name="user", diff --git a/counter/migrations/0005_auto_20160826_2330.py b/counter/migrations/0005_auto_20160826_2330.py index 4fa5ebea..37f3510e 100644 --- a/counter/migrations/0005_auto_20160826_2330.py +++ b/counter/migrations/0005_auto_20160826_2330.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -13,7 +14,10 @@ class Migration(migrations.Migration): model_name="counter", name="club", field=models.ForeignKey( - verbose_name="club", to="club.Club", related_name="counters" + on_delete=django.db.models.deletion.CASCADE, + verbose_name="club", + to="club.Club", + related_name="counters", ), ), migrations.AlterField( diff --git a/eboutic/migrations/0001_initial.py b/eboutic/migrations/0001_initial.py index 2eadf88c..8dd12da2 100644 --- a/eboutic/migrations/0001_initial.py +++ b/eboutic/migrations/0001_initial.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import accounting.models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -27,6 +28,7 @@ class Migration(migrations.Migration): ( "user", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="user", to=settings.AUTH_USER_MODEL, related_name="baskets", @@ -62,7 +64,10 @@ class Migration(migrations.Migration): ( "basket", models.ForeignKey( - verbose_name="basket", to="eboutic.Basket", related_name="items" + on_delete=django.db.models.deletion.CASCADE, + verbose_name="basket", + to="eboutic.Basket", + related_name="items", ), ), ], @@ -88,6 +93,7 @@ class Migration(migrations.Migration): ( "user", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="user", to=settings.AUTH_USER_MODEL, related_name="invoices", @@ -123,6 +129,7 @@ class Migration(migrations.Migration): ( "invoice", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="invoice", to="eboutic.Invoice", related_name="items", diff --git a/election/migrations/0001_initial.py b/election/migrations/0001_initial.py index 00e15cfa..943928cc 100644 --- a/election/migrations/0001_initial.py +++ b/election/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -120,6 +121,7 @@ class Migration(migrations.Migration): ( "election", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="election", to="election.Election", related_name="election_lists", @@ -151,6 +153,7 @@ class Migration(migrations.Migration): ( "election", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="election", to="election.Election", related_name="roles", @@ -181,7 +184,10 @@ class Migration(migrations.Migration): ( "role", models.ForeignKey( - verbose_name="role", to="election.Role", related_name="votes" + on_delete=django.db.models.deletion.CASCADE, + verbose_name="role", + to="election.Role", + related_name="votes", ), ), ], @@ -190,6 +196,7 @@ class Migration(migrations.Migration): model_name="candidature", name="election_list", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="election list", to="election.ElectionList", related_name="candidatures", @@ -199,13 +206,17 @@ class Migration(migrations.Migration): model_name="candidature", name="role", field=models.ForeignKey( - verbose_name="role", to="election.Role", related_name="candidatures" + on_delete=django.db.models.deletion.CASCADE, + verbose_name="role", + to="election.Role", + related_name="candidatures", ), ), migrations.AddField( model_name="candidature", name="user", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="user", to=settings.AUTH_USER_MODEL, related_name="candidates", diff --git a/forum/migrations/0001_initial.py b/forum/migrations/0001_initial.py index 63aa4dd8..065f5c46 100644 --- a/forum/migrations/0001_initial.py +++ b/forum/migrations/0001_initial.py @@ -6,6 +6,7 @@ from django.utils.timezone import utc from django.conf import settings import django.utils.timezone import datetime +import django.db.models.deletion class Migration(migrations.Migration): @@ -52,6 +53,7 @@ class Migration(migrations.Migration): ( "owner_club", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="club.Club", verbose_name="owner club", related_name="owned_forums", @@ -61,7 +63,11 @@ class Migration(migrations.Migration): ( "parent", models.ForeignKey( - to="forum.Forum", null=True, related_name="children", blank=True + on_delete=django.db.models.deletion.CASCADE, + to="forum.Forum", + null=True, + related_name="children", + blank=True, ), ), ( @@ -103,7 +109,9 @@ class Migration(migrations.Migration): ( "author", models.ForeignKey( - related_name="forum_messages", to=settings.AUTH_USER_MODEL + on_delete=django.db.models.deletion.CASCADE, + related_name="forum_messages", + to=settings.AUTH_USER_MODEL, ), ), ( @@ -149,12 +157,18 @@ class Migration(migrations.Migration): ), ( "message", - models.ForeignKey(related_name="metas", to="forum.ForumMessage"), + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="metas", + to="forum.ForumMessage", + ), ), ( "user", models.ForeignKey( - related_name="forum_message_metas", to=settings.AUTH_USER_MODEL + on_delete=django.db.models.deletion.CASCADE, + related_name="forum_message_metas", + to=settings.AUTH_USER_MODEL, ), ), ], @@ -180,10 +194,19 @@ class Migration(migrations.Migration): ( "author", models.ForeignKey( - related_name="forum_topics", to=settings.AUTH_USER_MODEL + on_delete=django.db.models.deletion.CASCADE, + related_name="forum_topics", + to=settings.AUTH_USER_MODEL, + ), + ), + ( + "forum", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="topics", + to="forum.Forum", ), ), - ("forum", models.ForeignKey(related_name="topics", to="forum.Forum")), ], options={"ordering": ["-id"]}, ), @@ -217,6 +240,10 @@ class Migration(migrations.Migration): migrations.AddField( model_name="forummessage", name="topic", - field=models.ForeignKey(related_name="messages", to="forum.ForumTopic"), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="messages", + to="forum.ForumTopic", + ), ), ] diff --git a/launderette/migrations/0001_initial.py b/launderette/migrations/0001_initial.py index c437d29d..f57526a9 100644 --- a/launderette/migrations/0001_initial.py +++ b/launderette/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -61,6 +62,7 @@ class Migration(migrations.Migration): ( "launderette", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="launderette", to="launderette.Launderette", related_name="machines", @@ -93,6 +95,7 @@ class Migration(migrations.Migration): ( "machine", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="machine", to="launderette.Machine", related_name="slots", @@ -131,6 +134,7 @@ class Migration(migrations.Migration): ( "launderette", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="launderette", to="launderette.Launderette", related_name="tokens", @@ -139,6 +143,7 @@ class Migration(migrations.Migration): ( "user", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, null=True, related_name="tokens", verbose_name="user", @@ -153,6 +158,7 @@ class Migration(migrations.Migration): model_name="slot", name="token", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, null=True, related_name="slots", verbose_name="token", @@ -164,7 +170,10 @@ class Migration(migrations.Migration): model_name="slot", name="user", field=models.ForeignKey( - verbose_name="user", to="core.User", related_name="slots" + on_delete=django.db.models.deletion.CASCADE, + verbose_name="user", + to="core.User", + related_name="slots", ), ), migrations.AlterUniqueTogether( diff --git a/sas/migrations/0002_auto_20161119_1241.py b/sas/migrations/0002_auto_20161119_1241.py index ed759ebc..f1b684d7 100644 --- a/sas/migrations/0002_auto_20161119_1241.py +++ b/sas/migrations/0002_auto_20161119_1241.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings +import django.db.models.deletion class Migration(migrations.Migration): @@ -28,12 +29,16 @@ class Migration(migrations.Migration): ( "picture", models.ForeignKey( - related_name="people", to="sas.Picture", verbose_name="picture" + on_delete=django.db.models.deletion.CASCADE, + related_name="people", + to="sas.Picture", + verbose_name="picture", ), ), ( "user", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="pictures", to=settings.AUTH_USER_MODEL, verbose_name="user", diff --git a/stock/migrations/0001_initial.py b/stock/migrations/0001_initial.py index 686d7e65..d98872c6 100644 --- a/stock/migrations/0001_initial.py +++ b/stock/migrations/0001_initial.py @@ -132,7 +132,11 @@ class Migration(migrations.Migration): ), ( "stock_owner", - models.ForeignKey(related_name="items", to="stock.Stock"), + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="items", + to="stock.Stock", + ), ), ( "type", @@ -151,7 +155,10 @@ class Migration(migrations.Migration): model_name="shoppinglistitem", name="stockitem_owner", field=models.ForeignKey( - null=True, related_name="shopping_item", to="stock.StockItem" + on_delete=django.db.models.deletion.CASCADE, + null=True, + related_name="shopping_item", + to="stock.StockItem", ), ), migrations.AddField( @@ -170,7 +177,10 @@ class Migration(migrations.Migration): model_name="shoppinglist", name="stock_owner", field=models.ForeignKey( - null=True, related_name="shopping_lists", to="stock.Stock" + on_delete=django.db.models.deletion.CASCADE, + null=True, + related_name="shopping_lists", + to="stock.Stock", ), ), ] diff --git a/subscription/migrations/0001_initial.py b/subscription/migrations/0001_initial.py index 2be00065..39c37994 100644 --- a/subscription/migrations/0001_initial.py +++ b/subscription/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.contrib.auth.models +import django.db.models.deletion class Migration(migrations.Migration): @@ -79,6 +80,10 @@ class Migration(migrations.Migration): migrations.AddField( model_name="subscription", name="member", - field=models.ForeignKey(to="core.User", related_name="subscriptions"), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="core.User", + related_name="subscriptions", + ), ), ] diff --git a/trombi/migrations/0001_initial.py b/trombi/migrations/0001_initial.py index 4f850f3d..bb8c393b 100644 --- a/trombi/migrations/0001_initial.py +++ b/trombi/migrations/0001_initial.py @@ -126,6 +126,7 @@ class Migration(migrations.Migration): model_name="trombicomment", name="author", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="trombi.TrombiUser", verbose_name="author", related_name="given_comments", @@ -135,6 +136,7 @@ class Migration(migrations.Migration): model_name="trombicomment", name="target", field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="trombi.TrombiUser", verbose_name="target", related_name="received_comments", diff --git a/trombi/migrations/0004_trombiclubmembership.py b/trombi/migrations/0004_trombiclubmembership.py index 2f6d3023..55813312 100644 --- a/trombi/migrations/0004_trombiclubmembership.py +++ b/trombi/migrations/0004_trombiclubmembership.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -40,6 +41,7 @@ class Migration(migrations.Migration): ( "user", models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, verbose_name="user", related_name="memberships", to="trombi.TrombiUser",