[Bug 40337] New: checkprevcheckout must be defined as ENUM at DB level
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Bug ID: 40337 Summary: checkprevcheckout must be defined as ENUM at DB level Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org They are VARCHAR(7) but they must be enum('yes', 'no', 'inherit') -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |40179, 40178 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40178 [Bug 40178] Add maxLength to the patron definition https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40179 [Bug 40179] Add maxLength to the patron's category definition -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 183918 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183918&action=edit Bug 40337: Define checkprevcheckout as ENUM On bug 40178 and bug 40179 we defined checkprevcheckout attributes as ENUM at the REST API level, so the specs prevent us from inserting values that are no yes, no, inherit in DB. However the DB schema didn't have that constraint. This has been caught by some tests that were failing: eg. t/db_dependent/selenium/patrons_search.t with "Not in enum list: yes, no, inherit." Test plan: Apply this patch, run `updatedatabase`, `dbic` and `restart_all` `prove t/db_dependent/selenium/patrons_search.t` should now pass. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 183919 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183919&action=edit Bug 40337: DBIC schema changes -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |jonathan.druart@gmail.com |ity.org | CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Eric Garcia <cubingguy714@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Eric Garcia <cubingguy714@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183919|0 |1 is obsolete| | --- Comment #3 from Eric Garcia <cubingguy714@gmail.com> --- Created attachment 183946 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183946&action=edit Bug 40337: DBIC schema changes Signed-off-by: Eric Garcia <cubingguy714@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183918|0 |1 is obsolete| | --- Comment #4 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 183947 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183947&action=edit Bug 40337: Define checkprevcheckout as ENUM On bug 40178 and bug 40179 we defined checkprevcheckout attributes as ENUM at the REST API level, so the specs prevent us from inserting values that are no yes, no, inherit in DB. However the DB schema didn't have that constraint. This has been caught by some tests that were failing: eg. t/db_dependent/selenium/patrons_search.t with "Not in enum list: yes, no, inherit." Test plan: Apply this patch, run `updatedatabase`, `dbic` and `restart_all` `prove t/db_dependent/selenium/patrons_search.t` should now pass. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183946|0 |1 is obsolete| | --- Comment #5 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 183948 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183948&action=edit Bug 40337: DBIC schema changes Signed-off-by: Eric Garcia <cubingguy714@gmail.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main --- Comment #6 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 25.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 183969 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183969&action=edit Bug 40337: Handle enum in Koha::Patron->anonymize We need to reset to the default value. We might have a problem (later) if it's NOT NULL and no default is set, which is not handled by this patch. But the situation does not seem to exist yet anyway. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #8 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 183970 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183970&action=edit Bug 40337: Do not set checkprevcheckout to an empty string when importing patrons We must remove it so that it will be set as the default value defined at the DBMS level -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |25.05.02 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #9 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 25.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #10 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- follow-ups pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- +-------------------+ | checkprevcheckout | +-------------------+ | inherit | | bpe8 | | MIbcjV | | ngYcotJ | | z85xcQ_ | | I523 | | zqw1P | | koirKi | | ErwNnJ | +-------------------+ Stuff from tests? Causing: ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Data truncated for column 'checkprevcheckout' at row 54 at /usr/share/koha/C4/Installer.pm line 825 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #12 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Marcel de Rooy from comment #11)
+-------------------+ | checkprevcheckout | +-------------------+ | inherit | | bpe8 | | MIbcjV | | ngYcotJ | | z85xcQ_ | | I523 | | zqw1P | | koirKi | | ErwNnJ | +-------------------+
Stuff from tests? Causing: ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Data truncated for column 'checkprevcheckout' at row 54 at /usr/share/koha/C4/Installer.pm line 825
This happens if you have run some tests before the DB changes. Then the REST API will explode because it will send strings that do not match the ENUM values. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|25.05.02 |25.11.00, 25.05.02 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #13 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 184396 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184396&action=edit Bug 40337: (QA follow-up) Make database update idempotent Running this update twice fails before this patch with: ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Data truncated for column 'checkprevcheckout' at row 3 at /kohadevbox/koha/C4/Installer.pm line 825 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |additional_work_needed CC| |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #14 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Hold off.. still failing for me -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #184396|0 |1 is obsolete| | --- Comment #15 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 184397 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184397&action=edit Bug 40337: (QA follow-up) Make database update idempotent Running this update twice fails before this patch with: ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Data truncated for column 'checkprevcheckout' at row 3 at /kohadevbox/koha/C4/Installer.pm line 825 Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #16 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Martin Renvoize (ashimema) from comment #15)
Created attachment 184397 [details] [review] Bug 40337: (QA follow-up) Make database update idempotent
Running this update twice fails before this patch with:
ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Data truncated for column 'checkprevcheckout' at row 3 at /kohadevbox/koha/C4/Installer.pm line 825
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
I cannot test right now but this patch does not feel correct. Why couldn't we rum the alter table statements several times? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #17 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 184425 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184425&action=edit Bug 40337: Remove test of datatype Keep the UPDATE to adjust bad data however. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #18 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 184856 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184856&action=edit Bug 40337: Fix DB comparison 00:40:25 koha-1 | < `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', 00:40:25 koha-1 | --- 00:40:25 koha-1 | > `checkprevcheckout` enum('yes','no','inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', 00:40:25 koha-1 | ERROR - DB structures are not identical -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |40548 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40548 [Bug 40548] diff in DB schema -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #19 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #18)
Created attachment 184856 [details] [review] Bug 40337: Fix DB comparison
00:40:25 koha-1 | < `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', 00:40:25 koha-1 | --- 00:40:25 koha-1 | > `checkprevcheckout` enum('yes','no','inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', 00:40:25 koha-1 | ERROR - DB structures are not identical
Moved to bug 40548. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |40558 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40558 [Bug 40558] Issue After Upgrading Koha from 25.05.01 to 25.05.02 – Patron Search Error -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |40528 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40528 [Bug 40528] Issue After Updating Koha to 25.05.02 – Member Search Error -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #20 from David Cook <dcook@prosentient.com.au> --- I'm not familiar with this bug, but it looks like bug 40528 and bug 40558 are opened because of it? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #21 from David Cook <dcook@prosentient.com.au> --- Ok I think I'm starting to see... I'm looking at installer/data/mysql/db_revs/250501001.pl on v25.05.02-1 and installer/data/mysql/db_revs/250600003.pl on main, and they don't include the Martin/Jonathan changes to installer/data/mysql/db_revs/250600003.pl It looks like they're missing the following SQL: UPDATE categories SET checkprevcheckout = 'inherit' WHERE checkprevcheckout NOT IN ('yes','no','inherit'); See the patches: Bug 40337: (QA follow-up) Make database update idempotent Bug 40337: Remove test of datatype -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #22 from David Cook <dcook@prosentient.com.au> --- Oh I see... Martin and Jonathan posted about it after the original patches were pushed... I don't understand how this was supposed to be managed... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.derscheid@lmscloud.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #23 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Was missing these commits in main: Bug 40337: (QA follow-up) Make database update idempotent Bug 40337: Remove test of datatype I have pushed them. The following isn't needed because it was pushed in Bug 40548: Bug 40337: Fix DB comparison -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #24 from David Cook <dcook@prosentient.com.au> --- Thanks for that, Lucas. Although after getting more info from users, it looks like that might not be the problem causing bug 40528. They claim that checkprevcheckout is "inherit" but still causing errors. I suppose we might see what happens as more people upgrade. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |20644 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20644 [Bug 20644] Per itemtype setting for CheckPrevCheckout -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Bug 40337 depends on bug 40178, which changed state. Bug 40178 Summary: Add maxLength to the patron definition https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40178 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Bug 40337 depends on bug 40179, which changed state. Bug 40179 Summary: Add maxLength to the patron's category definition https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40179 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|additional_work_needed | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Version(s)|25.11.00, 25.05.02 |25.11.00,25.05.02 released in| | --- Comment #25 from Fridolin Somers <fridolin.somers@biblibre.com> --- Can we set to needs documenting ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #26 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- (In reply to Fridolin Somers from comment #25)
Can we set to needs documenting ?
I guess it was up to 24.05 rmaint to decide whether they wanted to backport, but this depends on bugs not in 24.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 --- Comment #27 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- (In reply to Wainui Witika-Park from comment #26)
(In reply to Fridolin Somers from comment #25)
Can we set to needs documenting ?
I guess it was up to 24.05 rmaint to decide whether they wanted to backport, but this depends on bugs not in 24.05
Actually the rmaint of 24.11 but the dependent bugs aren't in 24.11 either -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40337 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Needs documenting --- Comment #28 from Fridolin Somers <fridolin.somers@biblibre.com> --- Indeed, so not for 24.11.x. Needs documenting ;) -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org