From 58d516e70d0645d60df3ad544a9d461e466b4020 Mon Sep 17 00:00:00 2001 From: Akiva Berger Date: Wed, 11 Dec 2024 16:11:56 +0200 Subject: [PATCH] fix(topics migrations): update the topic django model migrations to work with pg --- django_topics/migrations/0001_initial.py | 73 ++++++++++++++++--- .../migrations/0002_auto_20241121_0617.py | 38 ---------- .../migrations/0003_auto_20241121_0757.py | 24 ------ .../migrations/0004_auto_20241126_2359.py | 31 -------- .../migrations/0005_auto_20241127_0004.py | 20 ----- ...easonaltopicenglish_seasonaltopichebrew.py | 39 ---------- .../migrations/0007_auto_20241127_0034.py | 53 -------------- sefaria/model/tests/abstract_test.py | 1 - 8 files changed, 64 insertions(+), 215 deletions(-) delete mode 100644 django_topics/migrations/0002_auto_20241121_0617.py delete mode 100644 django_topics/migrations/0003_auto_20241121_0757.py delete mode 100644 django_topics/migrations/0004_auto_20241126_2359.py delete mode 100644 django_topics/migrations/0005_auto_20241127_0004.py delete mode 100644 django_topics/migrations/0006_seasonaltopicenglish_seasonaltopichebrew.py delete mode 100644 django_topics/migrations/0007_auto_20241127_0034.py diff --git a/django_topics/migrations/0001_initial.py b/django_topics/migrations/0001_initial.py index c73e0efeeb..4d937982e2 100644 --- a/django_topics/migrations/0001_initial.py +++ b/django_topics/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2024-11-19 08:18 +# Generated by Django 1.11.29 on 2024-12-11 13:57 from __future__ import unicode_literals from django.db import migrations, models @@ -18,36 +18,43 @@ class Migration(migrations.Migration): name='SeasonalTopic', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('start_date', models.DateField()), + ('start_date', models.DateField(help_text='Start date of when this will appear. End date is implied by when the next Seasonal Topic is displayed.')), ('display_start_date_israel', models.DateField(blank=True, null=True)), ('display_end_date_israel', models.DateField(blank=True, null=True)), ('display_start_date_diaspora', models.DateField(blank=True, null=True)), ('display_end_date_diaspora', models.DateField(blank=True, null=True)), + ('display_date_prefix', models.CharField(blank=True, max_length=255, null=True)), + ('display_date_suffix', models.CharField(blank=True, max_length=255, null=True)), + ('lang', models.CharField(choices=[('en', 'English'), ('he', 'Hebrew')], max_length=2)), ], options={ - 'verbose_name': 'Seasonal Topic', - 'verbose_name_plural': 'Seasonal Topics', + 'verbose_name': 'Landing Page - Calendar', + 'verbose_name_plural': 'Landing Page - Calendar', }, ), migrations.CreateModel( name='Topic', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('slug', models.CharField(max_length=255, unique=True)), + ('slug', models.CharField(max_length=255, primary_key=True, serialize=False)), ('en_title', models.CharField(blank=True, default='', max_length=255)), ('he_title', models.CharField(blank=True, default='', max_length=255)), ], + options={ + 'verbose_name': 'Topic Pool Management', + 'verbose_name_plural': 'Topic Pool Management', + }, ), migrations.CreateModel( name='TopicOfTheDay', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('start_date', models.DateField()), + ('lang', models.CharField(choices=[('en', 'English'), ('he', 'Hebrew')], max_length=2)), ('topic', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_of_the_day', to='django_topics.Topic')), ], options={ - 'verbose_name': 'Topic of the Day', - 'verbose_name_plural': 'Topics of the Day', + 'verbose_name': 'Landing Page - Topic of the Day', + 'verbose_name_plural': 'Landing Page - Topic of the Day', }, ), migrations.CreateModel( @@ -65,13 +72,61 @@ class Migration(migrations.Migration): migrations.AddField( model_name='seasonaltopic', name='secondary_topic', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='seasonal_secondary_topic', to='django_topics.Topic'), + field=models.ForeignKey(blank=True, help_text="Secondary topic which will be displayed alongside `topic`. E.g. `topic` is 'Teshuva' then secondary topic could be 'Yom Kippur'.", null=True, on_delete=django.db.models.deletion.CASCADE, related_name='seasonal_secondary_topic', to='django_topics.Topic'), ), migrations.AddField( model_name='seasonaltopic', name='topic', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seasonal_topic', to='django_topics.Topic'), ), + migrations.CreateModel( + name='SeasonalTopicEnglish', + fields=[ + ], + options={ + 'verbose_name': 'Landing Page - Calendar (EN)', + 'verbose_name_plural': 'Landing Page - Calendar (EN)', + 'proxy': True, + 'indexes': [], + }, + bases=('django_topics.seasonaltopic',), + ), + migrations.CreateModel( + name='SeasonalTopicHebrew', + fields=[ + ], + options={ + 'verbose_name': 'Landing Page - Calendar (HE)', + 'verbose_name_plural': 'Landing Page - Calendar (HE)', + 'proxy': True, + 'indexes': [], + }, + bases=('django_topics.seasonaltopic',), + ), + migrations.CreateModel( + name='TopicOfTheDayEnglish', + fields=[ + ], + options={ + 'verbose_name': 'Landing Page - Topic of the Day (EN)', + 'verbose_name_plural': 'Landing Page - Topic of the Day (EN)', + 'proxy': True, + 'indexes': [], + }, + bases=('django_topics.topicoftheday',), + ), + migrations.CreateModel( + name='TopicOfTheDayHebrew', + fields=[ + ], + options={ + 'verbose_name': 'Landing Page - Topic of the Day (HE)', + 'verbose_name_plural': 'Landing Page - Topic of the Day (HE)', + 'proxy': True, + 'indexes': [], + }, + bases=('django_topics.topicoftheday',), + ), migrations.AlterUniqueTogether( name='topicoftheday', unique_together=set([('topic', 'start_date')]), diff --git a/django_topics/migrations/0002_auto_20241121_0617.py b/django_topics/migrations/0002_auto_20241121_0617.py deleted file mode 100644 index ee2228f89e..0000000000 --- a/django_topics/migrations/0002_auto_20241121_0617.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2024-11-21 10:17 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_topics', '0001_initial'), - ] - - operations = [ - migrations.AlterModelOptions( - name='seasonaltopic', - options={'verbose_name': 'Landing Page - Calendar', 'verbose_name_plural': 'Landing Page - Calendar'}, - ), - migrations.AlterModelOptions( - name='topic', - options={'verbose_name': 'Topic Pool Management', 'verbose_name_plural': 'Topic Pool Management'}, - ), - migrations.AlterModelOptions( - name='topicoftheday', - options={'verbose_name': 'Landing Page - Topic of the Day', 'verbose_name_plural': 'Landing Page - Topic of the Day'}, - ), - migrations.AlterField( - model_name='seasonaltopic', - name='secondary_topic', - field=models.ForeignKey(blank=True, help_text="Secondary topic which will be displayed alongside `topic`. E.g. `topic` is 'Teshuva' then secondary topic could be 'Yom Kippur'.", null=True, on_delete=django.db.models.deletion.CASCADE, related_name='seasonal_secondary_topic', to='django_topics.Topic'), - ), - migrations.AlterField( - model_name='seasonaltopic', - name='start_date', - field=models.DateField(help_text='Start date of when this will appear. End date is implied by when the next Seasonal Topic is displayed.'), - ), - ] diff --git a/django_topics/migrations/0003_auto_20241121_0757.py b/django_topics/migrations/0003_auto_20241121_0757.py deleted file mode 100644 index a6765ce614..0000000000 --- a/django_topics/migrations/0003_auto_20241121_0757.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2024-11-21 11:57 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_topics', '0002_auto_20241121_0617'), - ] - - operations = [ - migrations.RemoveField( - model_name='topic', - name='id', - ), - migrations.AlterField( - model_name='topic', - name='slug', - field=models.CharField(max_length=255, primary_key=True, serialize=False), - ), - ] diff --git a/django_topics/migrations/0004_auto_20241126_2359.py b/django_topics/migrations/0004_auto_20241126_2359.py deleted file mode 100644 index 075a93cbf5..0000000000 --- a/django_topics/migrations/0004_auto_20241126_2359.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2024-11-27 03:59 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_topics', '0003_auto_20241121_0757'), - ] - - operations = [ - migrations.AddField( - model_name='seasonaltopic', - name='display_date_prefix', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='seasonaltopic', - name='display_date_suffix', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='seasonaltopic', - name='lang', - field=models.CharField(default='en', max_length=255), - preserve_default=False, - ), - ] diff --git a/django_topics/migrations/0005_auto_20241127_0004.py b/django_topics/migrations/0005_auto_20241127_0004.py deleted file mode 100644 index af7ca982fd..0000000000 --- a/django_topics/migrations/0005_auto_20241127_0004.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2024-11-27 04:04 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_topics', '0004_auto_20241126_2359'), - ] - - operations = [ - migrations.AlterField( - model_name='seasonaltopic', - name='lang', - field=models.CharField(choices=[('en', 'English'), ('he', 'Hebrew')], max_length=2), - ), - ] diff --git a/django_topics/migrations/0006_seasonaltopicenglish_seasonaltopichebrew.py b/django_topics/migrations/0006_seasonaltopicenglish_seasonaltopichebrew.py deleted file mode 100644 index 7cdded5723..0000000000 --- a/django_topics/migrations/0006_seasonaltopicenglish_seasonaltopichebrew.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2024-11-27 04:25 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_topics', '0005_auto_20241127_0004'), - ] - - operations = [ - migrations.CreateModel( - name='SeasonalTopicEnglish', - fields=[ - ], - options={ - 'verbose_name': 'English Seasonal Topic', - 'verbose_name_plural': 'English Seasonal Topics', - 'proxy': True, - 'indexes': [], - }, - bases=('django_topics.seasonaltopic',), - ), - migrations.CreateModel( - name='SeasonalTopicHebrew', - fields=[ - ], - options={ - 'verbose_name': 'Hebrew Seasonal Topic', - 'verbose_name_plural': 'Hebrew Seasonal Topics', - 'proxy': True, - 'indexes': [], - }, - bases=('django_topics.seasonaltopic',), - ), - ] diff --git a/django_topics/migrations/0007_auto_20241127_0034.py b/django_topics/migrations/0007_auto_20241127_0034.py deleted file mode 100644 index f375c1622f..0000000000 --- a/django_topics/migrations/0007_auto_20241127_0034.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2024-11-27 04:34 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_topics', '0006_seasonaltopicenglish_seasonaltopichebrew'), - ] - - operations = [ - migrations.CreateModel( - name='TopicOfTheDayEnglish', - fields=[ - ], - options={ - 'verbose_name': 'Landing Page - Topic of the Day (EN)', - 'verbose_name_plural': 'Landing Page - Topic of the Day (EN)', - 'proxy': True, - 'indexes': [], - }, - bases=('django_topics.topicoftheday',), - ), - migrations.CreateModel( - name='TopicOfTheDayHebrew', - fields=[ - ], - options={ - 'verbose_name': 'Landing Page - Topic of the Day (HE)', - 'verbose_name_plural': 'Landing Page - Topic of the Day (HE)', - 'proxy': True, - 'indexes': [], - }, - bases=('django_topics.topicoftheday',), - ), - migrations.AlterModelOptions( - name='seasonaltopicenglish', - options={'verbose_name': 'Landing Page - Calendar (EN)', 'verbose_name_plural': 'Landing Page - Calendar (EN)'}, - ), - migrations.AlterModelOptions( - name='seasonaltopichebrew', - options={'verbose_name': 'Landing Page - Calendar (HE)', 'verbose_name_plural': 'Landing Page - Calendar (HE)'}, - ), - migrations.AddField( - model_name='topicoftheday', - name='lang', - field=models.CharField(choices=[('en', 'English'), ('he', 'Hebrew')], default='en', max_length=2), - preserve_default=False, - ), - ] diff --git a/sefaria/model/tests/abstract_test.py b/sefaria/model/tests/abstract_test.py index 0b1efd1031..eba9cf0f44 100644 --- a/sefaria/model/tests/abstract_test.py +++ b/sefaria/model/tests/abstract_test.py @@ -3,7 +3,6 @@ import pytest from sefaria.system.database import db -from sefaria.system.exceptions import InputError import sefaria.model as model import sefaria.model.abstract as abstract