Bug 30889: (follow-up) Add context field to background_jobs

This patch adds a new 'context' field to the background_jobs table to
record the context in which the job was queued.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 72a6c8ba84)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2022-06-10 14:06:22 +01:00 committed by Lucas Gass
parent f334243222
commit 7d7f39b7d5
2 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1,15 @@
use Modern::Perl;
return {
bug_number => "30889",
description => "Add context to background_jobs",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
unless( column_exists( 'background_jobs', 'context') ) {
$dbh->do(q{ ALTER TABLE background_jobs ADD `context` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL AFTER `data` });
say $out "field added";
}
},
};

View file

@ -984,6 +984,7 @@ CREATE TABLE `background_jobs` (
`type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`queue` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'Name of the queue the job is sent to',
`data` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`context` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`enqueued_on` datetime DEFAULT NULL,
`started_on` datetime DEFAULT NULL,
`ended_on` datetime DEFAULT NULL,