From 1084068616a69000cf03ce640f9ca3acb7bd841f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Wed, 6 Mar 2024 12:03:03 +0100 Subject: [PATCH] queue_job: fix partial index to add 'wait_dependencies' state --- queue_job/__manifest__.py | 2 +- queue_job/migrations/15.0.2.3.6/pre-migration.py | 10 ++++++++++ queue_job/models/queue_job.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 queue_job/migrations/15.0.2.3.6/pre-migration.py diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py index 97cc820956..8fea895a4c 100644 --- a/queue_job/__manifest__.py +++ b/queue_job/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Job Queue", - "version": "15.0.2.3.5", + "version": "15.0.2.3.6", "author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/queue", "license": "LGPL-3", diff --git a/queue_job/migrations/15.0.2.3.6/pre-migration.py b/queue_job/migrations/15.0.2.3.6/pre-migration.py new file mode 100644 index 0000000000..53d9690caa --- /dev/null +++ b/queue_job/migrations/15.0.2.3.6/pre-migration.py @@ -0,0 +1,10 @@ +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html) + +from odoo.tools.sql import table_exists + + +def migrate(cr, version): + if table_exists(cr, "queue_job"): + # Drop index 'queue_job_identity_key_state_partial_index', + # it will be recreated during the update + cr.execute("DROP INDEX IF EXISTS queue_job_identity_key_state_partial_index;") diff --git a/queue_job/models/queue_job.py b/queue_job/models/queue_job.py index 7eb1620cfb..0f0b866273 100644 --- a/queue_job/models/queue_job.py +++ b/queue_job/models/queue_job.py @@ -139,7 +139,7 @@ def init(self): self._cr.execute( "CREATE INDEX queue_job_identity_key_state_partial_index " "ON queue_job (identity_key) WHERE state in ('pending', " - "'enqueued') AND identity_key IS NOT NULL;" + "'enqueued', 'wait_dependencies') AND identity_key IS NOT NULL;" ) @api.depends("records")