diff --git a/installer/data/mysql/atomicupdate/bug_38663.pl b/installer/data/mysql/atomicupdate/bug_38663.pl new file mode 100755 index 0000000000..1f2b0277fb --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_38663.pl @@ -0,0 +1,21 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "38663", + description => "Add additional fields to libraries", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do(q{ ALTER TABLE additional_field_values ADD COLUMN new_record_id VARCHAR(11) NOT NULL DEFAULT ''; }); + + $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; }); + + say_success( $out, "Converted record_id to VARCHAR" ); + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 6609f12bc0..9b7dc7fc6e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -247,7 +247,7 @@ DROP TABLE IF EXISTS `additional_field_values`; CREATE TABLE `additional_field_values` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier', `field_id` int(11) NOT NULL COMMENT 'foreign key references additional_fields(id)', - `record_id` int(11) NOT NULL COMMENT 'record_id', + `record_id` varchar(11) NOT NULL COMMENT 'record_id', `value` varchar(255) NOT NULL DEFAULT '' COMMENT 'value for this field', PRIMARY KEY (`id`), KEY `afv_fk` (`field_id`),