Bugzilla – Attachment 175356 Details for
Bug 38663
Add additional fields to libraries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38663: Preparation: Change record_id to varchar: database
Bug-38663-Preparation-Change-recordid-to-varchar-d.patch (text/plain), 2.41 KB, created by
Pedro Amorim
on 2024-12-10 15:18:39 UTC
(
hide
)
Description:
Bug 38663: Preparation: Change record_id to varchar: database
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-12-10 15:18:39 UTC
Size:
2.41 KB
patch
obsolete
>From 0d1723c82f759b7d1c7f44a030732d6dd0f54ee4 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Tue, 10 Dec 2024 14:44:44 +0000 >Subject: [PATCH] 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. >--- > .../data/mysql/atomicupdate/bug_38663.pl | 21 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 2 +- > 2 files changed, 22 insertions(+), 1 deletion(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_38663.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_38663.pl b/installer/data/mysql/atomicupdate/bug_38663.pl >new file mode 100755 >index 00000000000..1f2b0277fb9 >--- /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 3bf15c1007d..c8d6ceb2c9a 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`), >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38663
:
175355
| 175356 |
175357
|
175358
|
175359
|
175370