diff --git a/django_celery_beat/migrations/0005_add_solarschedule_events_choices.py b/django_celery_beat/migrations/0005_add_solarschedule_events_choices.py new file mode 100644 index 00000000..db09b9d0 --- /dev/null +++ b/django_celery_beat/migrations/0005_add_solarschedule_events_choices.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.1 on 2017-11-01 15:53 +from __future__ import absolute_import, unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('django_celery_beat', '0004_auto_20170221_0000'), + ] + + operations = [ + migrations.AlterField( + model_name='solarschedule', + name='event', + field=models.CharField(choices=[ + ('dawn_astronomical', 'dawn_astronomical'), + ('dawn_civil', 'dawn_civil'), + ('dawn_nautical', 'dawn_nautical'), + ('dusk_astronomical', 'dusk_astronomical'), + ('dusk_civil', 'dusk_civil'), + ('dusk_nautical', 'dusk_nautical'), + ('solar_noon', 'solar_noon'), + ('sunrise', 'sunrise'), + ('sunset', 'sunset') + ], + max_length=24, verbose_name='event'), + ), + ] diff --git a/django_celery_beat/migrations/0005_add_solarschedule_events_choices_squashed_0009_merge_20181012_1416.py b/django_celery_beat/migrations/0005_add_solarschedule_events_choices_squashed_0009_merge_20181012_1416.py deleted file mode 100644 index 04f182ce..00000000 --- a/django_celery_beat/migrations/0005_add_solarschedule_events_choices_squashed_0009_merge_20181012_1416.py +++ /dev/null @@ -1,95 +0,0 @@ -# Generated by Django 2.1.2 on 2018-10-12 14:18 -from __future__ import absolute_import, unicode_literals - -from django.db import migrations, models -import django_celery_beat.validators -import timezone_field.fields - - -class Migration(migrations.Migration): - dependencies = [ - ('django_celery_beat', '0004_auto_20170221_0000'), - ] - - operations = [ - migrations.AlterField( - model_name='solarschedule', - name='event', - field=models.CharField( - choices=[('dawn_astronomical', 'dawn_astronomical'), - ('dawn_civil', 'dawn_civil'), - ('dawn_nautical', 'dawn_nautical'), - ('dusk_astronomical', 'dusk_astronomical'), - ('dusk_civil', 'dusk_civil'), - ('dusk_nautical', 'dusk_nautical'), - ('solar_noon', 'solar_noon'), ('sunrise', 'sunrise'), - ('sunset', 'sunset')], max_length=24, - verbose_name='event'), - ), - migrations.AlterModelOptions( - name='crontabschedule', - options={ - 'ordering': ['month_of_year', 'day_of_month', 'day_of_week', - 'hour', 'minute', 'timezone'], - 'verbose_name': 'crontab', 'verbose_name_plural': 'crontabs'}, - ), - migrations.AlterModelOptions( - name='crontabschedule', - options={ - 'ordering': ['month_of_year', 'day_of_month', 'day_of_week', - 'hour', 'minute', 'timezone'], - 'verbose_name': 'crontab', 'verbose_name_plural': 'crontabs'}, - ), - migrations.AddField( - model_name='crontabschedule', - name='timezone', - field=timezone_field.fields.TimeZoneField(default='UTC'), - ), - migrations.AddField( - model_name='periodictask', - name='one_off', - field=models.BooleanField(default=False, - verbose_name='one-off task'), - ), - migrations.AddField( - model_name='periodictask', - name='start_time', - field=models.DateTimeField(blank=True, null=True, - verbose_name='start_time'), - ), - migrations.AlterField( - model_name='crontabschedule', - name='day_of_month', - field=models.CharField(default='*', max_length=124, validators=[ - django_celery_beat.validators.day_of_month_validator], - verbose_name='day of month'), - ), - migrations.AlterField( - model_name='crontabschedule', - name='day_of_week', - field=models.CharField(default='*', max_length=64, validators=[ - django_celery_beat.validators.day_of_week_validator], - verbose_name='day of week'), - ), - migrations.AlterField( - model_name='crontabschedule', - name='hour', - field=models.CharField(default='*', max_length=96, validators=[ - django_celery_beat.validators.hour_validator], - verbose_name='hour'), - ), - migrations.AlterField( - model_name='crontabschedule', - name='minute', - field=models.CharField(default='*', max_length=240, validators=[ - django_celery_beat.validators.minute_validator], - verbose_name='minute'), - ), - migrations.AlterField( - model_name='crontabschedule', - name='month_of_year', - field=models.CharField(default='*', max_length=64, validators=[ - django_celery_beat.validators.month_of_year_validator], - verbose_name='month of year'), - ), - ] diff --git a/django_celery_beat/migrations/0006_auto_20180210_1226.py b/django_celery_beat/migrations/0006_auto_20180210_1226.py new file mode 100644 index 00000000..b5267e1e --- /dev/null +++ b/django_celery_beat/migrations/0006_auto_20180210_1226.py @@ -0,0 +1,32 @@ +# Generated by Django 2.0.1 on 2018-02-10 12:26 +from __future__ import absolute_import, unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('django_celery_beat', '0005_add_solarschedule_events_choices'), + ] + + operations = [ + migrations.AlterField( + model_name='crontabschedule', + name='day_of_month', + field=models.CharField(default='*', max_length=124, + verbose_name='day of month'), + ), + migrations.AlterField( + model_name='crontabschedule', + name='hour', + field=models.CharField(default='*', max_length=96, + verbose_name='hour'), + ), + migrations.AlterField( + model_name='crontabschedule', + name='minute', + field=models.CharField(default='*', max_length=240, + verbose_name='minute'), + ), + ] diff --git a/django_celery_beat/migrations/0006_auto_20180322_0932.py b/django_celery_beat/migrations/0006_auto_20180322_0932.py new file mode 100644 index 00000000..92d0eabc --- /dev/null +++ b/django_celery_beat/migrations/0006_auto_20180322_0932.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.7 on 2018-03-22 16:32 +from __future__ import absolute_import, unicode_literals + +from django.db import migrations, models +import timezone_field.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('django_celery_beat', '0005_add_solarschedule_events_choices'), + # ('django_celery_beat', '0006_auto_20180210_1226'), + ] + + operations = [ + migrations.AlterModelOptions( + name='crontabschedule', + options={ + 'ordering': [ + 'month_of_year', 'day_of_month', + 'day_of_week', 'hour', 'minute', 'timezone' + ], + 'verbose_name': 'crontab', + 'verbose_name_plural': 'crontabs' + }, + ), + migrations.AddField( + model_name='crontabschedule', + name='timezone', + field=timezone_field.fields.TimeZoneField(default='UTC'), + ), + migrations.AlterField( + model_name='crontabschedule', + name='day_of_month', + field=models.CharField( + default='*', max_length=124, verbose_name='day of month' + ), + ), + migrations.AlterField( + model_name='crontabschedule', + name='hour', + field=models.CharField( + default='*', max_length=96, verbose_name='hour' + ), + ), + migrations.AlterField( + model_name='crontabschedule', + name='minute', + field=models.CharField( + default='*', max_length=240, verbose_name='minute' + ), + ), + ] diff --git a/django_celery_beat/migrations/0006_periodictask_priority.py b/django_celery_beat/migrations/0006_periodictask_priority.py index 8f13065a..cd3fb210 100644 --- a/django_celery_beat/migrations/0006_periodictask_priority.py +++ b/django_celery_beat/migrations/0006_periodictask_priority.py @@ -7,7 +7,13 @@ class Migration(migrations.Migration): dependencies = [ - ('django_celery_beat', '0005_add_solarschedule_events_choices_squashed_0009_merge_20181012_1416'), # noqa + # depends on higher numbers due to a squashed migration + # that was later removed due to migration issues it caused + ('django_celery_beat', '0005_add_solarschedule_events_choices'), + ('django_celery_beat', '0006_auto_20180210_1226'), + ('django_celery_beat', '0006_auto_20180322_0932'), + ('django_celery_beat', '0007_auto_20180521_0826'), + ('django_celery_beat', '0008_auto_20180914_1922'), ] operations = [ diff --git a/django_celery_beat/migrations/0007_auto_20180521_0826.py b/django_celery_beat/migrations/0007_auto_20180521_0826.py new file mode 100644 index 00000000..1ed46468 --- /dev/null +++ b/django_celery_beat/migrations/0007_auto_20180521_0826.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-05-21 08:26 +from __future__ import absolute_import, unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('django_celery_beat', '0006_auto_20180322_0932'), + ] + + operations = [ + migrations.AddField( + model_name='periodictask', + name='one_off', + field=models.BooleanField(default=False, + verbose_name='one-off task'), + ), + migrations.AddField( + model_name='periodictask', + name='start_time', + field=models.DateTimeField(blank=True, + null=True, + verbose_name='start_time'), + ), + ] diff --git a/django_celery_beat/migrations/0008_auto_20180914_1922.py b/django_celery_beat/migrations/0008_auto_20180914_1922.py new file mode 100644 index 00000000..475f0464 --- /dev/null +++ b/django_celery_beat/migrations/0008_auto_20180914_1922.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Generated by Django 2.0.3 on 2018-09-14 19:22 +from __future__ import absolute_import, unicode_literals + +from django.db import migrations, models +from django_celery_beat import validators + + +class Migration(migrations.Migration): + dependencies = [ + ('django_celery_beat', '0007_auto_20180521_0826'), + ] + + operations = [ + migrations.AlterField( + model_name='crontabschedule', + name='day_of_month', + field=models.CharField( + default='*', max_length=124, + validators=[validators.day_of_month_validator], + verbose_name='day of month' + ), + ), + migrations.AlterField( + model_name='crontabschedule', + name='day_of_week', + field=models.CharField( + default='*', max_length=64, + validators=[validators.day_of_week_validator], + verbose_name='day of week' + ), + ), + migrations.AlterField( + model_name='crontabschedule', + name='hour', + field=models.CharField( + default='*', max_length=96, + validators=[validators.hour_validator], + verbose_name='hour' + ), + ), + migrations.AlterField( + model_name='crontabschedule', + name='minute', + field=models.CharField( + default='*', max_length=240, + validators=[validators.minute_validator], + verbose_name='minute' + ), + ), + migrations.AlterField( + model_name='crontabschedule', + name='month_of_year', + field=models.CharField( + default='*', max_length=64, + validators=[validators.month_of_year_validator], + verbose_name='month of year' + ), + ), + ] diff --git a/django_celery_beat/migrations/0011_fix_migration_history.py b/django_celery_beat/migrations/0011_fix_migration_history.py deleted file mode 100644 index 6ca5d698..00000000 --- a/django_celery_beat/migrations/0011_fix_migration_history.py +++ /dev/null @@ -1,31 +0,0 @@ -from __future__ import absolute_import, unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_celery_beat', '0010_auto_20190429_0326'), - ] - - operations = [ - # delete the squashed migration history of migrations replaced by - # 0005_add_solarschedule_events_choices_squashed_0009_merge_20181012_1416 - # the squashed file was convertd to a normal migration and the py files - # were deleted, so we must also delete them from the history. - # this is necessary because the squashed file was somehow screwing up - # this history for version 1.3.0 installs that were upgraded. - migrations.RunSQL([( - """ - delete from django_migrations where app='django_celery_beat' and ( - name = '0005_add_solarschedule_events_choices' - or name = '0006_auto_20180210_1226' - or name = '0006_auto_20180322_0932' - or name = '0007_auto_20180521_0826' - or name = '0008_auto_20180914_1922' - ) - """, None)], - reverse_sql=migrations.RunSQL.noop - ), - ] diff --git a/t/unit/test_models.py b/t/unit/test_models.py index 2aecc980..c96b366a 100644 --- a/t/unit/test_models.py +++ b/t/unit/test_models.py @@ -12,7 +12,7 @@ class MigrationTests(TestCase): - def test_no_duplicate_migration_numbers(self): + def test_no_future_duplicate_migration_numbers(self): """Verify no duplicate migration numbers. Migration files with the same number can cause issues with @@ -20,9 +20,15 @@ def test_no_duplicate_migration_numbers(self): """ path = os.path.dirname(beat_migrations.__file__) files = [f[:4] for f in os.listdir(path) if f.endswith('.py')] + expected_duplicates = [ + (3, '0006'), + ] + duplicates_extra = sum(count - 1 for count, _ in expected_duplicates) + duplicates_numbers = [number for _, number in expected_duplicates] self.assertEqual( - len(files), len(set(files)), - msg='Detected migration files with the same migration number') + len(files), len(set(files)) + duplicates_extra, + msg=('Detected migration files with the same migration number' + ' (besides {})'.format(' and '.join(duplicates_numbers)))) def test_models_match_migrations(self): """Make sure that no model changes exist.