Summary: | Koha upgrade error "Column 'claimed_on' cannot be null" | ||
---|---|---|---|
Product: | Koha | Reporter: | Saiful Amin <saiful> |
Component: | Installation and upgrade (command-line installer) | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | major | ||
Priority: | P5 - low | CC: | david, jonathan.druart, lucas, saiful |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This fixes an upgrade error that could result in data loss when upgrading from earlier releases to 20.05 (and later releases). It results in the claim_dates for orders being replaced with the date the upgrade was run. (This was caused by an error in the database update for bug 24161 - Add ability to track the claim dates of later orders.)
|
Version(s) released in: |
22.11.00, 22.05.03
|
Circulation function: | |||
Bug Depends on: | 24161 | ||
Bug Blocks: | |||
Attachments: |
Bug 30539: (bug 24161 follow-up) Fix typo in DBrev
Bug 30539: (bug 24161 follow-up) Fix typo in DBrev Bug 30539: (bug 24161 follow-up) Fix typo in DBrev |
Description
Saiful Amin
2022-04-14 07:04:16 UTC
There is a possible bug in: /usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl (OR [master]/installer/data/mysql/updatedatabase.pl) While checking the code I observed that the orders object has three values and 'claimed_on' is not one of them: 22053 my $orders = $dbh->selectall_arrayref(q| 22054 SELECT ordernumber, claims_count, claimed_date 22055 FROM aqorders So, the possible patch is making following change in the line 22065 of the updatedatabase.pl: 22063 for my $order ( @$orders ) { 22064 for my $claim (1..$order->{claims_count}) { -22065 $insert_claim_sth->execute($order->{ordernumber}, $order->{claimed_on}); +22065 $insert_claim_sth->execute($order->{ordernumber}, $order->{claimed_date}); 22066 } 22067 } The above change fixed the upgrade process for us. Created attachment 135464 [details] [review] Bug 30539: (bug 24161 follow-up) Fix typo in DBrev As the upgrade process crashes we should be safe and not need to update the existing data. However I am wondering why this hasn't been reported earlier. Created attachment 135516 [details] [review] Bug 30539: (bug 24161 follow-up) Fix typo in DBrev Signed-off-by: David Nind <david@davidnind.com> Testing notes (using koha-testing-docker): - I haven't tested an upgrade from 17.x to 21.x. - I have reviewed the patch and comments - the change resolved the upgrade issue experienced, comments on the original bug. Feel free to change status back to needs sign off, or provide some feedback on how to test. Created attachment 135735 [details] [review] Bug 30539: (bug 24161 follow-up) Fix typo in DBrev Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> This is a data loss bug too. We either didn't notice or didn't have the error, but it results in the claim_dates being replaced with today's date on migration to the new table. Please backport to all necessary releases. Pushed to master for 22.11. Nice work everyone, thanks! Backported to 22.05.x for 22.05.03 |