Summary: | checkprevcheckout must be defined as ENUM at DB level | ||
---|---|---|---|
Product: | Koha | Reporter: | Jonathan Druart <jonathan.druart> |
Component: | Architecture, internals, and plumbing | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | Pushed to stable --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | lucas, m.de.rooy |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Small patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: |
25.05.02
|
Circulation function: | |
Bug Depends on: | 40178, 40179 | ||
Bug Blocks: | |||
Attachments: |
Bug 40337: Define checkprevcheckout as ENUM
Bug 40337: DBIC schema changes Bug 40337: DBIC schema changes Bug 40337: Define checkprevcheckout as ENUM Bug 40337: DBIC schema changes Bug 40337: Handle enum in Koha::Patron->anonymize Bug 40337: Do not set checkprevcheckout to an empty string when importing patrons |
Description
Jonathan Druart
2025-07-10 07:06:46 UTC
Created attachment 183918 [details] [review] 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. Created attachment 183919 [details] [review] Bug 40337: DBIC schema changes Created attachment 183946 [details] [review] Bug 40337: DBIC schema changes Signed-off-by: Eric Garcia <cubingguy714@gmail.com> Created attachment 183947 [details] [review] 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> Created attachment 183948 [details] [review] Bug 40337: DBIC schema changes Signed-off-by: Eric Garcia <cubingguy714@gmail.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Nice work everyone! Pushed to main for 25.11 Created attachment 183969 [details] [review] 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. Created attachment 183970 [details] [review] 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 Nice work everyone! Pushed to 25.05.x follow-ups pushed to main +-------------------+ | 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 (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. |