Skip to content

Commit

Permalink
queue_job: fix partial index to add 'wait_dependencies' state
Browse files Browse the repository at this point in the history
  • Loading branch information
sebalix committed Mar 7, 2024
1 parent c549681 commit 1084068
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion queue_job/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 10 additions & 0 deletions queue_job/migrations/15.0.2.3.6/pre-migration.py
Original file line number Diff line number Diff line change
@@ -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;")
2 changes: 1 addition & 1 deletion queue_job/models/queue_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 1084068

Please sign in to comment.