From 58007d31fcf3be2f7e5ebc345b9e2716a57ccf4d Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 5 May 2025 15:15:31 -0300 Subject: [PATCH] Bug 39837: Rename (aqbookseller_interfaces) column interface_id to vendor_interface_id Signed-off-by: Martin Renvoize --- .../data/mysql/atomicupdate/bug_39837.pl | 25 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 +-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_39837.pl diff --git a/installer/data/mysql/atomicupdate/bug_39837.pl b/installer/data/mysql/atomicupdate/bug_39837.pl new file mode 100755 index 00000000000..a698167e551 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_39837.pl @@ -0,0 +1,25 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "39837", + description => "Rename interface_id -> vendor_interface_id", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( TableExists('aqbookseller_interfaces') ) { + if ( column_exists( 'aqbookseller_interfaces', 'interface_id' ) ) { + $dbh->do( + q{ + ALTER TABLE aqbookseller_interfaces RENAME COLUMN interface_id TO vendor_interface_id; + } + ); + say_success( + $out, + q{Column 'aqbookseller_interfaces.interface_id' renamed to 'aqbookseller_interfaces.vendor_interface_id'} + ); + } + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 70274e8d48c..a10357eeed1 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -435,7 +435,7 @@ DROP TABLE IF EXISTS `aqbookseller_interfaces`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `aqbookseller_interfaces` ( - `interface_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha', + `vendor_interface_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha', `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor', `type` varchar(80) DEFAULT NULL COMMENT 'type of the interface, authorised value VENDOR_INTERFACE_TYPE', `name` varchar(255) NOT NULL COMMENT 'name of the interface', @@ -444,7 +444,7 @@ CREATE TABLE `aqbookseller_interfaces` ( `password` mediumtext DEFAULT NULL COMMENT 'hashed password', `account_email` mediumtext DEFAULT NULL COMMENT 'account email', `notes` longtext DEFAULT NULL COMMENT 'notes', - PRIMARY KEY (`interface_id`), + PRIMARY KEY (`vendor_interface_id`), KEY `aqbookseller_interfaces_ibfk_1` (`vendor_id`), CONSTRAINT `aqbookseller_interfaces_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.49.0