Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

j4mie
Copy link
Member

@j4mie j4mie commented Aug 18, 2021

This is #41 with the migrations reinstated. The initial migration has been edited to remove the jsonfield dependency. Because jsonfield is just a TextField underneath, Django should theoretically be able to migrate this to being a proper JSONField without a problem. This should theoretically make the upgrade path much smoother.

Needs to be tested on a real project.

Update: tested on a real (internal) project. The migrations applied cleanly and the tests all pass. This is a good sign 😎

The database table looks right:

\d django_dbq_job
                     Table "public.django_dbq_job"
   Column   |           Type           | Collation | Nullable | Default
------------+--------------------------+-----------+----------+---------
 id         | uuid                     |           | not null |
 created    | timestamp with time zone |           | not null |
 modified   | timestamp with time zone |           | not null |
 name       | character varying(100)   |           | not null |
 state      | character varying(20)    |           | not null |
 next_task  | character varying(100)   |           | not null |
 workspace  | jsonb                    |           |          |
 queue_name | character varying(20)    |           | not null |
 priority   | smallint                 |           | not null |

And the jobs that were already in the table were migrated correctly too.


Description copied from #41

So.. this PR does quite a lot, and when it is released will be backwards incompatible. This was necessary to support anything newer than Django 2.2.

django-db-queue is now quite old, and relies on a bunch of unmaintained dependencies. This PR removes them all, at the cost of making the upgrade path a bit of a pain. Details are in the README but in short: you have to drop the jobs table and recreate it.

We now use the cross-database JSONField implementation that was added in Django 3.1, rather than a third-party unmaintained thing. I've also removed the dependency on my own simplesignals library (which I haven't touched in nine years!)

I've removed some stuff that was never used (the create_job management command (which didn't work anyway) and the JobSerializer, which I'd forgotten even existed.

@j4mie j4mie mentioned this pull request Aug 19, 2021
Closed
@j4mie j4mie merged commit 0254ac1 into master Aug 19, 2021
@j4mie j4mie deleted the 2.0-with-migrations branch August 19, 2021 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants