Bug 40292: Prevent SQL syntax error when upgrading to 25.05 on MariaDB 10.3

- Change `RENAME COLUMN <OLD> TO <NEW>` to `CHANGE COLUMN <OLD> <NEW>
  <DATATYPE (required for this syntax)>`.

To test (assuming ktd):
1. Checkout upstream/24.11.x
2. Start ktd with `KOHA_IMAGE=24.11-bullseye(-arm64) DB_IMAGE=mariadb:10.3 ktd up
   -d`
3. Checkout upstream/main
4. Run updatedatabase in the Koha container
5. Observe the error regarding the unsupported syntax.
6. Tear everything down again: ktd down
7. Repeat 1-2.
8. Once started up, checkout upstream/main
9. Apply the patch on top of it
10. Run updatedatabase in the Koha container
11. Observe a successful upgrade
12. Sign off

Side Note: I tested this against upstream/25.05.x, but this patch is
based on main.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Paul Derscheid 2025-07-02 18:30:32 +02:00 committed by Lucas Gass
parent ec66781149
commit 33f39f55af
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
3 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ return {
);
$dbh->do(q{ UPDATE additional_field_values SET new_record_id = CAST(record_id AS CHAR(11)); });
$dbh->do(q{ ALTER TABLE additional_field_values DROP COLUMN record_id; });
$dbh->do(q{ ALTER TABLE additional_field_values RENAME COLUMN new_record_id TO record_id; });
$dbh->do(q{ ALTER TABLE additional_field_values CHANGE COLUMN new_record_id record_id VARCHAR(11); });
say_success( $out, "Converted record_id to VARCHAR" );
} else {

View File

@ -12,7 +12,7 @@ return {
if ( column_exists( 'aqbookseller_aliases', 'alias_id' ) ) {
$dbh->do(
q{
ALTER TABLE aqbookseller_aliases RENAME COLUMN alias_id TO vendor_alias_id;
ALTER TABLE aqbookseller_aliases CHANGE COLUMN alias_id vendor_alias_id INT(11);
}
);
say_success(

View File

@ -12,7 +12,7 @@ return {
if ( column_exists( 'aqbookseller_interfaces', 'interface_id' ) ) {
$dbh->do(
q{
ALTER TABLE aqbookseller_interfaces RENAME COLUMN interface_id TO vendor_interface_id;
ALTER TABLE aqbookseller_interfaces CHANGE COLUMN interface_id vendor_interface_id INT(11);
}
);
say_success(