Bugzilla – Attachment 150115 Details for
Bug 32745
Jobs view breaks when there are jobs with context IS NULL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32745: Adjust context for invalid background jobs
Bug-32745-Adjust-context-for-invalid-background-jo.patch (text/plain), 1.76 KB, created by
David Nind
on 2023-04-23 06:55:26 UTC
(
hide
)
Description:
Bug 32745: Adjust context for invalid background jobs
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-04-23 06:55:26 UTC
Size:
1.76 KB
patch
obsolete
>From c18f8bf6175ddfe6f94bc7dfcda713f4b0790d51 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 24 Mar 2023 11:17:58 +0100 >Subject: [PATCH] Bug 32745: Adjust context for invalid background jobs > >We had some problems recently and it's possible to have >background_jobs.context=NULL >But the REST API specs is expecting an object. >We could either modify the specs, or adjust the incorrect entries in DB, >which is IMO better. > >Test plan: >0. Don't apply the patch >1. Create some background jobs >2. Set context to NULL >UPDATE background_jobs SET context=NULL; >3. List the jobs and note the datatable error, and the error in Koha log > OpenAPI >>> GET api/v1/jobs [{"message":"Expected object - got null.","path":"\/body\/0\/context"},{"message":"Expected object - got null.","path":"\/body\/1\/context"}] > >4. Apply the patch >5. Run `updatedatabase` >6. Confirm that the list and detail view are not working correctly > >Signed-off-by: David Nind <david@davidnind.com> >--- > installer/data/mysql/atomicupdate/bug_32745.pl | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_32745.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_32745.pl b/installer/data/mysql/atomicupdate/bug_32745.pl >new file mode 100755 >index 0000000000..94e2cd0ba1 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_32745.pl >@@ -0,0 +1,15 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "32745", >+ description => "Update context={} for invalid background jobs", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ $dbh->do(q{ >+ UPDATE background_jobs >+ SET context="{}" >+ WHERE context IS NULL >+ }); >+ }, >+}; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32745
:
148643
|
150115
|
150118