From 8ae641f5280cc1e8ef0edd19150bec5b95508bcb Mon Sep 17 00:00:00 2001 From: David D Lowe Date: Thu, 13 Jun 2024 18:53:04 +0100 Subject: [PATCH] Create migration file after change in .inviter This is required because of the change introduced in this commit: 4235da2d3f5091be6c3c751b41f15acb1f5b4ddf Also, create a test to ensure that future commits don't forget to create any necessary migration files. --- .../0005_alter_invitation_inviter.py | 29 +++++++++++++++++++ tests/test_migrations.py | 13 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 invitations/migrations/0005_alter_invitation_inviter.py create mode 100644 tests/test_migrations.py diff --git a/invitations/migrations/0005_alter_invitation_inviter.py b/invitations/migrations/0005_alter_invitation_inviter.py new file mode 100644 index 0000000..5a6201e --- /dev/null +++ b/invitations/migrations/0005_alter_invitation_inviter.py @@ -0,0 +1,29 @@ +# Generated by Django 4.2.13 on 2024-06-13 12:44 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ("invitations", "0004_auto_20230328_1430"), + ] + + operations = [ + migrations.AlterField( + model_name="invitation", + name="inviter", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="%(app_label)s_%(class)ss", + related_query_name="%(app_label)s_%(class)s", + to=settings.AUTH_USER_MODEL, + verbose_name="inviter", + ), + ), + ] diff --git a/tests/test_migrations.py b/tests/test_migrations.py new file mode 100644 index 0000000..4d71b47 --- /dev/null +++ b/tests/test_migrations.py @@ -0,0 +1,13 @@ +import pytest +from django.core.management import call_command + + +class TestMigrations: + @pytest.mark.django_db + def test_all_necessary_migrations_created(self): + try: + call_command("makemigrations", "--check", "--dry-run") + all_necessary_migrations_created = True + except SystemExit: + all_necessary_migrations_created = False + assert all_necessary_migrations_created