diff --git a/README.md b/README.md index 917e600..5a55d00 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,6 @@ Add `django_dbq` to your installed apps ### Upgrading from 1.x to 2.x -This library underwent significant changes in its 2.x release, which meant migrating automatically was not practical. Before upgrading, you should open a database shell and run the following commands. Note that this will **delete all your existing jobs**, so you should ensure all jobs are completed before proceeding, and make sure you don't need any data at all from the jobs table. - -``` -DROP TABLE django_dbq_job; -DELETE FROM django_migrations WHERE app='django_dbq'; -``` - -Then, run `python manage.py migrate` to recreate the jobs table. - Note that version 2.x only supports Django 3.1 or newer. If you need support for Django 2.2, please stick with the latest 1.x release. ### Describe your job diff --git a/django_dbq/migrations/0001_initial.py b/django_dbq/migrations/0001_initial.py index 6ed4e08..d5114d3 100644 --- a/django_dbq/migrations/0001_initial.py +++ b/django_dbq/migrations/0001_initial.py @@ -1,12 +1,13 @@ -# Generated by Django 3.2rc1 on 2021-04-05 14:31 +# -*- coding: utf-8 -*- +from __future__ import unicode_literals -from django.db import migrations, models +from django.db import models, migrations import uuid +from django.db.models import UUIDField -class Migration(migrations.Migration): - initial = True +class Migration(migrations.Migration): dependencies = [] @@ -16,39 +17,38 @@ class Migration(migrations.Migration): fields=[ ( "id", - models.UUIDField( - default=uuid.uuid4, + UUIDField( + serialize=False, editable=False, + default=uuid.uuid4, primary_key=True, - serialize=False, ), ), - ("created", models.DateTimeField(auto_now_add=True, db_index=True)), + ("created", models.DateTimeField(db_index=True, auto_now_add=True)), ("modified", models.DateTimeField(auto_now=True)), ("name", models.CharField(max_length=100)), ( "state", models.CharField( - choices=[ - ("NEW", "New"), - ("READY", "Ready"), - ("PROCESSING", "Processing"), - ("FAILED", "Failed"), - ("COMPLETE", "Complete"), - ], db_index=True, - default="NEW", max_length=20, + default="NEW", + choices=[ + ("NEW", "NEW"), + ("READY", "READY"), + ("PROCESSING", "PROCESSING"), + ("FAILED", "FAILED"), + ("COMPLETE", "COMPLETE"), + ], ), ), - ("next_task", models.CharField(blank=True, max_length=100)), - ("workspace", models.JSONField(null=True)), + ("next_task", models.CharField(max_length=100, blank=True)), + ("workspace", models.TextField(null=True)), ( "queue_name", - models.CharField(db_index=True, default="default", max_length=20), + models.CharField(db_index=True, max_length=20, default="default"), ), - ("priority", models.SmallIntegerField(db_index=True, default=0)), ], - options={"ordering": ["-priority", "created"],}, + options={"ordering": ["-created"],}, ), ] diff --git a/django_dbq/migrations/0002_auto_20151016_1027.py b/django_dbq/migrations/0002_auto_20151016_1027.py new file mode 100644 index 0000000..d0a72c4 --- /dev/null +++ b/django_dbq/migrations/0002_auto_20151016_1027.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("django_dbq", "0001_initial"), + ] + + operations = [ + migrations.AlterModelOptions(name="job", options={"ordering": ["created"]},), + ] diff --git a/django_dbq/migrations/0003_auto_20180713_1000.py b/django_dbq/migrations/0003_auto_20180713_1000.py new file mode 100644 index 0000000..4d959f3 --- /dev/null +++ b/django_dbq/migrations/0003_auto_20180713_1000.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2018-07-13 10:00 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("django_dbq", "0002_auto_20151016_1027"), + ] + + operations = [ + migrations.AlterModelOptions( + name="job", options={"ordering": ["-priority", "created"]}, + ), + migrations.AddField( + model_name="job", + name="priority", + field=models.SmallIntegerField(db_index=True, default=0), + ), + ] diff --git a/django_dbq/migrations/0004_auto_20210818_0247.py b/django_dbq/migrations/0004_auto_20210818_0247.py new file mode 100644 index 0000000..a1ff5ff --- /dev/null +++ b/django_dbq/migrations/0004_auto_20210818_0247.py @@ -0,0 +1,32 @@ +# Generated by Django 3.2rc1 on 2021-08-18 02:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("django_dbq", "0003_auto_20180713_1000"), + ] + + operations = [ + migrations.AlterField( + model_name="job", + name="state", + field=models.CharField( + choices=[ + ("NEW", "New"), + ("READY", "Ready"), + ("PROCESSING", "Processing"), + ("FAILED", "Failed"), + ("COMPLETE", "Complete"), + ], + db_index=True, + default="NEW", + max_length=20, + ), + ), + migrations.AlterField( + model_name="job", name="workspace", field=models.JSONField(null=True), + ), + ]