From 8966de83afd3c8f2803c4f6929f8ce6c85a1a7d8 Mon Sep 17 00:00:00 2001 From: git_admin Date: Mon, 27 Apr 2026 08:46:47 +0000 Subject: [PATCH] Tower: upload queue_job 16.0.2.12.0 (via marketplace) --- .../migrations/15.0.1.1.0/pre-migration.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 addons/queue_job/migrations/15.0.1.1.0/pre-migration.py diff --git a/addons/queue_job/migrations/15.0.1.1.0/pre-migration.py b/addons/queue_job/migrations/15.0.1.1.0/pre-migration.py new file mode 100644 index 0000000..8ae6cb3 --- /dev/null +++ b/addons/queue_job/migrations/15.0.1.1.0/pre-migration.py @@ -0,0 +1,33 @@ +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html) + +from odoo.tools.sql import column_exists, table_exists + + +def migrate(cr, version): + if table_exists(cr, "queue_job") and not column_exists( + cr, "queue_job", "exec_time" + ): + # Disable trigger otherwise the update takes ages. + cr.execute( + """ + ALTER TABLE queue_job DISABLE TRIGGER queue_job_notify; + """ + ) + cr.execute( + """ + ALTER TABLE queue_job ADD COLUMN exec_time double precision DEFAULT 0; + """ + ) + cr.execute( + """ + UPDATE + queue_job + SET + exec_time = EXTRACT(EPOCH FROM (date_done - date_started)); + """ + ) + cr.execute( + """ + ALTER TABLE queue_job ENABLE TRIGGER queue_job_notify; + """ + )