Bug 38663: Preparation: Change record_id to varchar: database
record_if in the additional_field_values is an int(11) This works for most cases, but in the branches case, the id column is actually a varchar (branchcode). This patch updates the column to accomodate for this. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
139fff4b27
commit
93c65bec84
2 changed files with 22 additions and 1 deletions
21
installer/data/mysql/atomicupdate/bug_38663.pl
Executable file
21
installer/data/mysql/atomicupdate/bug_38663.pl
Executable file
|
@ -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" );
|
||||
},
|
||||
};
|
|
@ -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`),
|
||||
|
|
Loading…
Reference in a new issue