Bug 38522

Summary: Increase length of erm_argreements.license_info
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: DatabaseAssignee: Andrew Fuerste-Henry <andrew>
Status: Pushed to oldoldstable --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, lucas, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00,24.11.01,24.05.06,23.11.11
Circulation function:
Attachments: Bug 38522: Increase erm_agreements.license_info length
Bug 38522: update kohastructure.sql
Bug 38522: update kohastructure.sql
Bug 38522: Increase erm_agreements.license_info length
Bug 38522: update kohastructure.sql
Bug 38522: followup to preserve comment in sql structure
Bug 38522: (follow-up) edit dbrev in preserve comment

Description Andrew Fuerste-Henry 2024-11-22 19:22:08 UTC
https://schema.koha-community.org/24_05/tables/erm_agreements.html

erm_agreements.license_info is limited to 80 characters. Users would like to be able to store more information here.

erm_agreement_licenses.notes and erm_agreement_periods.notes are both MEDIUMTEXT fields allowing up to 16777215 characters.
Comment 1 Andrew Fuerste-Henry 2024-11-22 20:11:24 UTC
Created attachment 174946 [details] [review]
Bug 38522: Increase erm_agreements.license_info length

to test:
1- try to save an agreement with 81+ characters in License Info
2- it does not save
3- apply patch, updatedatabase
4- repeat 1, it works!
Comment 2 Andrew Fuerste-Henry 2024-11-22 20:11:26 UTC
Created attachment 174947 [details] [review]
Bug 38522: update kohastructure.sql
Comment 3 Lucas Gass (lukeg) 2024-11-22 20:19:32 UTC
Created attachment 174948 [details] [review]
Bug 38522: update kohastructure.sql

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Lucas Gass (lukeg) 2024-11-22 20:20:30 UTC
Created attachment 174949 [details] [review]
Bug 38522: Increase erm_agreements.license_info length

to test:
1- try to save an agreement with 81+ characters in License Info
2- it does not save
3- apply patch, updatedatabase
4- repeat 1, it works!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 5 Lucas Gass (lukeg) 2024-11-22 20:20:33 UTC
Created attachment 174950 [details] [review]
Bug 38522: update kohastructure.sql

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 6 Lucas Gass (lukeg) 2024-11-22 20:24:49 UTC
Database update fails:

	ERROR: {UNKNOWN}: Undefined subroutine &C4::Installer::say_success called at /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl line 21. at /kohadevbox/koha/C4/Installer.pm line 743
Comment 7 Lucas Gass (lukeg) 2024-11-22 20:25:35 UTC
(In reply to Lucas Gass (lukeg) from comment #6)
> Database update fails:
> 
> 	ERROR: {UNKNOWN}: Undefined subroutine &C4::Installer::say_success called
> at
> /kohadevbox/koha/installer/data/mysql/atomicupdate/
> bug_35145_order_patron_attributes.pl line 21. at
> /kohadevbox/koha/C4/Installer.pm line 743

Sorry, commented on the wrong bug. This database update is great.
Comment 8 Katrin Fischer 2024-12-03 16:14:10 UTC
Hi Andrew, please make sure to use the new skeleton.pl as a base for your atomic update files. You should use "say_success" for example.
Comment 9 Katrin Fischer 2024-12-03 16:16:16 UTC
(In reply to Katrin Fischer from comment #8)
> Hi Andrew, please make sure to use the new skeleton.pl as a base for your
> atomic update files. You should use "say_success" for example.

Hm, I just realized the file needs some more updating for the examples :)
Comment 10 Katrin Fischer 2024-12-03 16:36:27 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 11 Jonathan Druart 2024-12-09 09:28:20 UTC
Koha_Main_MariaDB_update/10 is failing because of this.

19:22:12 koha_1       | --- a/Koha/Schema/Result/ErmAgreement.pm
19:22:12 koha_1       | +++ b/Koha/Schema/Result/ErmAgreement.pm
19:22:12 koha_1       | @@ -88,11 +88,8 @@ priority of the renewal
19:22:12 koha_1       |  
19:22:12 koha_1       |  =head2 license_info
19:22:12 koha_1       |  
19:22:12 koha_1       | -  data_type: 'varchar'
19:22:12 koha_1       | +  data_type: 'mediumtext'
19:22:12 koha_1       |    is_nullable: 1
19:22:12 koha_1       | -  size: 80
19:22:12 koha_1       | -
19:22:12 koha_1       | -info about the license
19:22:12 koha_1       |  
19:22:12 koha_1       |  =cut
19:22:12 koha_1       |  
19:22:12 koha_1       | @@ -114,7 +111,7 @@ __PACKAGE__->add_columns(
19:22:12 koha_1       |    "renewal_priority",
19:22:12 koha_1       |    { data_type => "varchar", is_nullable => 1, size => 80 },
19:22:12 koha_1       |    "license_info",
19:22:12 koha_1       | -  { data_type => "varchar", is_nullable => 1, size => 80 },
19:22:12 koha_1       | +  { data_type => "mediumtext", is_nullable => 1 },
19:22:12 koha_1       |  );
19:22:12 koha_1       |  
19:22:12 koha_1       |  =head1 PRIMARY KEY
19:22:12 koha_1       | @@ -267,8 +264,8 @@ Composing rels: L</erm_eholdings_packages_agreements> -> package
19:22:12 koha_1       |  __PACKAGE__->many_to_many("packages", "erm_eholdings_packages_agreements", "package");
19:22:12 koha_1       |  
19:22:12 koha_1       |  
19:22:12 koha_1       | -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-11 11:52:09
19:22:12 koha_1       | -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:N93LnvdKirtuV6BSrTGzVg
19:22:12 koha_1       | +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-12-03 18:22:02
19:22:12 koha_1       | +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:08W7MMLmEW7KvG1GAlLM2w
19:22:12 koha_1       |  
19:22:13 koha_1       |  __PACKAGE__->has_many(
19:22:13 koha_1       |    "user_roles",
19:22:26 koha_1       | ERROR - There is a diff in DBIC schema files

This is because the ALTER statement is missing the COMMENT part.
Comment 12 Andrew Fuerste-Henry 2024-12-09 18:01:21 UTC
Created attachment 175327 [details] [review]
Bug 38522: followup to preserve comment in sql structure

This patch contains a new database update that corrects the missing comment in the schema structure.
Comment 13 Andrew Fuerste-Henry 2024-12-09 18:02:52 UTC
I've included a new database update that includes that comment. I wasn't sure if that should be handled here as a followup or go on a new bug. I'm happy to file one as desired. Thanks!
Comment 14 Katrin Fischer 2024-12-09 18:04:41 UTC
Hi Andrew, as we just started and noone should have run your database update yet, I think we can just adjust the db_rev directly. 
Please also write "(follow-up)" - the QA tools will complain otherwise :)
Comment 15 Andrew Fuerste-Henry 2024-12-09 19:39:44 UTC
Created attachment 175332 [details] [review]
Bug 38522: (follow-up) edit dbrev in preserve comment
Comment 16 Andrew Fuerste-Henry 2024-12-09 19:42:03 UTC
(In reply to Katrin Fischer from comment #14)
> Hi Andrew, as we just started and noone should have run your database update
> yet, I think we can just adjust the db_rev directly. 
> Please also write "(follow-up)" - the QA tools will complain otherwise :)

Ok, new follow-up patch attached that just edits the dbrev. I obsoleted the new database update I attached earlier today. Thanks, all!
Comment 17 Paul Derscheid 2024-12-12 13:31:21 UTC
Nice work everyone!

Pushed to 24.11.x for 24.11.01
Comment 18 Katrin Fischer 2024-12-12 15:02:10 UTC
Follow-up pushed to main. Fixed "DEFUALT" and amended the patch before pushing.
Comment 19 Wainui Witika-Park 2024-12-17 23:39:21 UTC
Backported to 24.05.x for 24.05.06
Comment 20 Fridolin Somers 2024-12-18 15:58:56 UTC
Pushed to 23.11.x for 23.11.11