From e81457ca340171312b143f6e5844b912ed249a2b Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 5 May 2025 14:54:56 -0300 Subject: [PATCH] Bug 39838: Rename (aqbookseller_aliases) column alias_id to vendor_alias_id Signed-off-by: David Nind Signed-off-by: Martin Renvoize --- .../data/mysql/atomicupdate/bug_39838.pl | 25 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 +-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_39838.pl diff --git a/installer/data/mysql/atomicupdate/bug_39838.pl b/installer/data/mysql/atomicupdate/bug_39838.pl new file mode 100755 index 00000000000..1e1ae6cb036 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_39838.pl @@ -0,0 +1,25 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "39838", + description => "Rename alias_id -> vendor_alias_id", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( TableExists('aqbookseller_aliases') ) { + if ( column_exists( 'aqbookseller_aliases', 'alias_id' ) ) { + $dbh->do( + q{ + ALTER TABLE aqbookseller_aliases RENAME COLUMN alias_id TO vendor_alias_id; + } + ); + say_success( + $out, + q{Column 'aqbookseller_aliases.alias_id' renamed to 'aqbookseller_aliases.vendor_alias_id'} + ); + } + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 3602c65c18e..70274e8d48c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -418,10 +418,10 @@ DROP TABLE IF EXISTS `aqbookseller_aliases`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `aqbookseller_aliases` ( - `alias_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha', + `vendor_alias_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', `alias` varchar(255) NOT NULL COMMENT 'the alias', - PRIMARY KEY (`alias_id`), + PRIMARY KEY (`vendor_alias_id`), KEY `aqbookseller_aliases_ibfk_1` (`vendor_id`), CONSTRAINT `aqbookseller_aliases_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