Bugzilla – Attachment 182401 Details for
Bug 35451
Add tablename field to additional_field_values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35451: Add record_table to additional_field_values
Bug-35451-Add-recordtable-to-additionalfieldvalues.patch (text/plain), 3.29 KB, created by
Martin Renvoize (ashimema)
on 2025-05-13 19:10:25 UTC
(
hide
)
Description:
Bug 35451: Add record_table to additional_field_values
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-05-13 19:10:25 UTC
Size:
3.29 KB
patch
obsolete
>From 58177662995b5663b62e651235eef7f0c0f60569 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 30 Nov 2023 11:31:02 +0000 >Subject: [PATCH] Bug 35451: Add record_table to additional_field_values > >This patch updates the database to include a record_table field in the >additional_field_values table and adds an index on that field. > >This should facilitate more performant joins. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../data/mysql/atomicupdate/bug_35451.pl | 41 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 2 + > 2 files changed, 43 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_35451.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_35451.pl b/installer/data/mysql/atomicupdate/bug_35451.pl >new file mode 100755 >index 00000000000..3c9951b67dc >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35451.pl >@@ -0,0 +1,41 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "35451", >+ description => "Add record_table field and index to additional_field_values", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ unless ( column_exists( 'additional_field_values', 'record_table' ) ) { >+ $dbh->do( >+ q{ >+ ALTER TABLE additional_field_values ADD record_table varchar(255) NOT NULL DEFAULT '' COMMENT 'tablename of the related record' AFTER field_id >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ UPDATE >+ additional_field_values AS v >+ INNER JOIN >+ additional_fields AS f ON f.id = v.field_id >+ SET >+ v.record_table = f.tablename >+ } >+ ); >+ say $out "Added column 'additional_field_values.record_table'"; >+ } >+ >+ unless ( index_exists( 'additional_field_values', 'record_table' ) ) { >+ $dbh->do( >+ q{ >+ ALTER TABLE `additional_field_values` >+ ADD KEY `record_table` (`record_table`) >+ } >+ ); >+ >+ say $out "Added index 'record_table' to 'additional_field_values'"; >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index ea14dcee2a0..42f54848ba7 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -247,10 +247,12 @@ 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_table` varchar(255) NOT NULL DEFAULT '' COMMENT 'tablename of the related record', > `record_id` varchar(11) NOT NULL DEFAULT '' COMMENT 'record_id', > `value` varchar(255) NOT NULL DEFAULT '' COMMENT 'value for this field', > PRIMARY KEY (`id`), > KEY `afv_fk` (`field_id`), >+ KEY `record_table` (`record_table`), > CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > /*!40101 SET character_set_client = @saved_cs_client */; >-- >2.49.0
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 35451
:
159390
|
159391
|
159392
|
159393
|
159394
|
159747
|
159748
|
159749
|
159750
|
159751
|
173147
|
173148
|
173149
|
173150
|
173151
|
173421
|
173422
|
173423
|
173424
|
173425
|
178332
|
178333
|
178334
|
178335
|
178336
|
178337
|
178338
|
178339
|
178340
|
178341
|
180806
|
180807
|
180808
|
180809
|
180810
|
182401
|
182402
|
182403
|
182404
|
182405
|
182406
|
182407
|
182408
|
182409
|
182410
|
182411
|
182412
|
182413