From 107c65b8b905234ebeaac6d184c3196c0fef77ee Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Sun, 16 Jul 2023 17:48:49 +0200 Subject: [PATCH] Fix migration history --- aleksis/core/migrations/0049_calendarevent.py | 76 ------ aleksis/core/migrations/0050_fix_amends.py | 19 -- .../0051_calendarevent_and_holiday.py | 164 +++++++++++++ .../migrations/0051_calendarevent_dates.py | 92 -------- aleksis/core/migrations/0052_holiday.py | 36 --- ...t_managers_alter_activity_site_and_more.py | 223 ------------------ .../migrations/0054_calendarevent_timezone.py | 51 ---- 7 files changed, 164 insertions(+), 497 deletions(-) delete mode 100644 aleksis/core/migrations/0049_calendarevent.py delete mode 100644 aleksis/core/migrations/0050_fix_amends.py create mode 100644 aleksis/core/migrations/0051_calendarevent_and_holiday.py delete mode 100644 aleksis/core/migrations/0051_calendarevent_dates.py delete mode 100644 aleksis/core/migrations/0052_holiday.py delete mode 100644 aleksis/core/migrations/0053_alter_calendarevent_managers_alter_activity_site_and_more.py delete mode 100644 aleksis/core/migrations/0054_calendarevent_timezone.py diff --git a/aleksis/core/migrations/0049_calendarevent.py b/aleksis/core/migrations/0049_calendarevent.py deleted file mode 100644 index d2f54fc4a..000000000 --- a/aleksis/core/migrations/0049_calendarevent.py +++ /dev/null @@ -1,76 +0,0 @@ -# Generated by Django 4.1.5 on 2023-01-29 13:46 - -import aleksis.core.managers -import aleksis.core.mixins -from django.db import migrations, models -import django.db.models.deletion -import recurrence.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ("sites", "0002_alter_domain_unique"), - ("contenttypes", "0002_remove_content_type_name"), - ("core", "0048_delete_personalicalurl"), - ] - - operations = [ - migrations.CreateModel( - name="CalendarEvent", - fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, primary_key=True, serialize=False, verbose_name="ID" - ), - ), - ("extended_data", models.JSONField(default=dict, editable=False)), - ("start", models.DateTimeField(verbose_name="Start date and time")), - ("end", models.DateTimeField(verbose_name="End date and time")), - ( - "recurrences", - recurrence.fields.RecurrenceField( - blank=True, null=True, verbose_name="Recurrences" - ), - ), - ( - "ammends", - models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.CASCADE, - to="core.calendarevent", - verbose_name="Ammended base event", - ), - ), - ( - "polymorphic_ctype", - models.ForeignKey( - editable=False, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="polymorphic_%(app_label)s.%(class)s_set+", - to="contenttypes.contenttype", - ), - ), - ( - "site", - models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - to="sites.site", - ), - ), - ], - options={ - "verbose_name": "Calendar Event", - "verbose_name_plural": "Calendar Events", - }, - bases=(aleksis.core.mixins.CalendarEventMixin, models.Model), - managers=[ - ("objects", aleksis.core.managers.PolymorphicCurrentSiteManager()), - ], - ), - ] diff --git a/aleksis/core/migrations/0050_fix_amends.py b/aleksis/core/migrations/0050_fix_amends.py deleted file mode 100644 index 09ea72fb0..000000000 --- a/aleksis/core/migrations/0050_fix_amends.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 4.1.7 on 2023-03-26 10:26 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - dependencies = [ - ("sites", "0002_alter_domain_unique"), - ("core", "0049_calendarevent"), - ] - - operations = [ - migrations.RenameField( - model_name="calendarevent", - old_name="ammends", - new_name="amends", - ), - ] diff --git a/aleksis/core/migrations/0051_calendarevent_and_holiday.py b/aleksis/core/migrations/0051_calendarevent_and_holiday.py new file mode 100644 index 000000000..28e529402 --- /dev/null +++ b/aleksis/core/migrations/0051_calendarevent_and_holiday.py @@ -0,0 +1,164 @@ +# Generated by Django 4.1.10 on 2023-07-11 19:01 + +import aleksis.core.managers +import aleksis.core.mixins +from django.db import migrations, models +import django.db.models.deletion +import recurrence.fields +import timezone_field.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("contenttypes", "0002_remove_content_type_name"), + ("sites", "0002_alter_domain_unique"), + ("core", "0050_managed_by_app_label"), + ] + + operations = [ + migrations.CreateModel( + name="CalendarEvent", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, primary_key=True, serialize=False, verbose_name="ID" + ), + ), + ( + "managed_by_app_label", + models.CharField( + blank=True, + editable=False, + max_length=255, + verbose_name="App label of app responsible for managing this instance", + ), + ), + ("extended_data", models.JSONField(default=dict, editable=False)), + ( + "datetime_start", + models.DateTimeField(blank=True, null=True, verbose_name="Start date and time"), + ), + ( + "datetime_end", + models.DateTimeField(blank=True, null=True, verbose_name="End date and time"), + ), + ( + "timezone", + timezone_field.fields.TimeZoneField( + blank=True, null=True, verbose_name="Timezone" + ), + ), + ("date_start", models.DateField(blank=True, null=True, verbose_name="Start date")), + ("date_end", models.DateField(blank=True, null=True, verbose_name="End date")), + ( + "recurrences", + recurrence.fields.RecurrenceField( + blank=True, null=True, verbose_name="Recurrences" + ), + ), + ( + "amends", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="amended_by", + to="core.calendarevent", + verbose_name="Amended base event", + ), + ), + ( + "polymorphic_ctype", + models.ForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="polymorphic_%(app_label)s.%(class)s_set+", + to="contenttypes.contenttype", + ), + ), + ( + "site", + models.ForeignKey( + default=1, + editable=False, + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="sites.site", + ), + ), + ], + options={ + "verbose_name": "Calendar Event", + "verbose_name_plural": "Calendar Events", + "ordering": ["datetime_start", "date_start", "datetime_end", "date_end"], + }, + bases=(aleksis.core.mixins.CalendarEventMixin, models.Model), + managers=[ + ("objects", aleksis.core.managers.PolymorphicCurrentSiteManager()), + ], + ), + migrations.CreateModel( + name="Holiday", + fields=[ + ( + "calendarevent_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.calendarevent", + ), + ), + ("holiday_name", models.CharField(max_length=255, verbose_name="Name")), + ], + options={ + "verbose_name": "Holiday", + "verbose_name_plural": "Holidays", + }, + bases=("core.calendarevent",), + managers=[ + ("objects", aleksis.core.managers.PolymorphicCurrentSiteManager()), + ], + ), + migrations.AddConstraint( + model_name="calendarevent", + constraint=models.CheckConstraint( + check=models.Q( + ("date_start__isnull", True), ("datetime_start__isnull", True), _negated=True + ), + name="datetime_start_or_date_start", + ), + ), + migrations.AddConstraint( + model_name="calendarevent", + constraint=models.CheckConstraint( + check=models.Q( + ("date_end__isnull", True), ("datetime_end__isnull", True), _negated=True + ), + name="datetime_end_or_date_end", + ), + ), + migrations.AddConstraint( + model_name="calendarevent", + constraint=models.CheckConstraint( + check=models.Q( + ("datetime_start__isnull", False), ("timezone__isnull", True), _negated=True + ), + name="timezone_if_datetime_start", + ), + ), + migrations.AddConstraint( + model_name="calendarevent", + constraint=models.CheckConstraint( + check=models.Q( + ("datetime_end__isnull", False), ("timezone__isnull", True), _negated=True + ), + name="timezone_if_datetime_end", + ), + ), + ] diff --git a/aleksis/core/migrations/0051_calendarevent_dates.py b/aleksis/core/migrations/0051_calendarevent_dates.py deleted file mode 100644 index e4b0bc3e7..000000000 --- a/aleksis/core/migrations/0051_calendarevent_dates.py +++ /dev/null @@ -1,92 +0,0 @@ -# Generated by Django 4.1.8 on 2023-04-08 15:25 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - dependencies = [ - ("sites", "0002_alter_domain_unique"), - ("core", "0050_fix_amends"), - ] - - operations = [ - migrations.AlterModelOptions( - name="calendarevent", - options={ - "ordering": ["datetime_start", "date_start", "datetime_end", "date_end"], - "verbose_name": "Calendar Event", - "verbose_name_plural": "Calendar Events", - }, - ), - migrations.RenameField( - model_name="calendarevent", - old_name="end", - new_name="datetime_end", - ), - migrations.RenameField( - model_name="calendarevent", - old_name="start", - new_name="datetime_start", - ), - migrations.AddField( - model_name="calendarevent", - name="date_end", - field=models.DateField(blank=True, null=True, verbose_name="End date"), - ), - migrations.AddField( - model_name="calendarevent", - name="date_start", - field=models.DateField(blank=True, null=True, verbose_name="Start date"), - ), - migrations.AlterField( - model_name="calendarevent", - name="amends", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.CASCADE, - to="core.calendarevent", - verbose_name="Amended base event", - ), - ), - migrations.AlterField( - model_name="calendarevent", - name="datetime_end", - field=models.DateTimeField(blank=True, null=True, verbose_name="End date and time"), - ), - migrations.AlterField( - model_name="calendarevent", - name="datetime_start", - field=models.DateTimeField(blank=True, null=True, verbose_name="Start date and time"), - ), - migrations.AlterField( - model_name="calendarevent", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AddConstraint( - model_name="calendarevent", - constraint=models.CheckConstraint( - check=models.Q( - ("date_start__isnull", True), ("datetime_start__isnull", True), _negated=True - ), - name="datetime_start_or_date_start", - ), - ), - migrations.AddConstraint( - model_name="calendarevent", - constraint=models.CheckConstraint( - check=models.Q( - ("date_end__isnull", True), ("datetime_end__isnull", True), _negated=True - ), - name="datetime_end_or_date_end", - ), - ), - ] diff --git a/aleksis/core/migrations/0052_holiday.py b/aleksis/core/migrations/0052_holiday.py deleted file mode 100644 index ed2e75ba0..000000000 --- a/aleksis/core/migrations/0052_holiday.py +++ /dev/null @@ -1,36 +0,0 @@ -# Generated by Django 4.1.8 on 2023-04-09 14:09 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - dependencies = [ - ("sites", "0002_alter_domain_unique"), - ("core", "0051_calendarevent_dates"), - ] - - operations = [ - migrations.CreateModel( - name="Holiday", - fields=[ - ( - "calendarevent_ptr", - models.OneToOneField( - auto_created=True, - on_delete=django.db.models.deletion.CASCADE, - parent_link=True, - primary_key=True, - serialize=False, - to="core.calendarevent", - ), - ), - ("holiday_name", models.CharField(max_length=255, verbose_name="Name")), - ], - options={ - "verbose_name": "Holiday", - "verbose_name_plural": "Holidays", - }, - bases=("core.calendarevent",), - ), - ] diff --git a/aleksis/core/migrations/0053_alter_calendarevent_managers_alter_activity_site_and_more.py b/aleksis/core/migrations/0053_alter_calendarevent_managers_alter_activity_site_and_more.py deleted file mode 100644 index 452e18e2a..000000000 --- a/aleksis/core/migrations/0053_alter_calendarevent_managers_alter_activity_site_and_more.py +++ /dev/null @@ -1,223 +0,0 @@ -# Generated by Django 4.1.8 on 2023-05-01 17:55 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - dependencies = [ - ("sites", "0002_alter_domain_unique"), - ("core", "0052_holiday"), - ] - - operations = [ - migrations.AlterModelManagers( - name="calendarevent", - managers=[], - ), - migrations.AlterField( - model_name="activity", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="additionalfield", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="announcement", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="announcementrecipient", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="custommenu", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="custommenuitem", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="dashboardwidgetorder", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="datacheckresult", - name="data_check", - field=models.CharField( - choices=[ - ( - "broken_dashboard_widgets", - "Ensure that there are no broken DashboardWidgets.", - ), - ( - "field_validation_custommenuitem_icon", - "Validate field icon of model core.CustomMenuItem.", - ), - ], - max_length=255, - verbose_name="Related data check task", - ), - ), - migrations.AlterField( - model_name="datacheckresult", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="group", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="grouptype", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="notification", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="pdffile", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="person", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="persongroupthrough", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="room", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="schoolterm", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - migrations.AlterField( - model_name="taskuserassignment", - name="site", - field=models.ForeignKey( - default=1, - editable=False, - on_delete=django.db.models.deletion.CASCADE, - related_name="+", - to="sites.site", - ), - ), - ] diff --git a/aleksis/core/migrations/0054_calendarevent_timezone.py b/aleksis/core/migrations/0054_calendarevent_timezone.py deleted file mode 100644 index f2a98b3d7..000000000 --- a/aleksis/core/migrations/0054_calendarevent_timezone.py +++ /dev/null @@ -1,51 +0,0 @@ -# Generated by Django 4.1.9 on 2023-05-29 11:00 - -from django.db import migrations, models -import django.db.models.deletion -import timezone_field.fields - - -class Migration(migrations.Migration): - dependencies = [ - ("core", "0053_alter_calendarevent_managers_alter_activity_site_and_more"), - ] - - operations = [ - migrations.AddField( - model_name="calendarevent", - name="timezone", - field=timezone_field.fields.TimeZoneField( - blank=True, null=True, verbose_name="Timezone" - ), - ), - migrations.AlterField( - model_name="calendarevent", - name="amends", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="amended_by", - to="core.calendarevent", - verbose_name="Amended base event", - ), - ), - migrations.AddConstraint( - model_name="calendarevent", - constraint=models.CheckConstraint( - check=models.Q( - ("datetime_start__isnull", False), ("timezone__isnull", True), _negated=True - ), - name="timezone_if_datetime_start", - ), - ), - migrations.AddConstraint( - model_name="calendarevent", - constraint=models.CheckConstraint( - check=models.Q( - ("datetime_end__isnull", False), ("timezone__isnull", True), _negated=True - ), - name="timezone_if_datetime_end", - ), - ), - ] -- GitLab