Bugzilla – Attachment 42884 Details for
Bug 14899
Mapping configuration page for Elastic search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14899: DB changes
Bug-14899-DB-changes.patch (text/plain), 5.88 KB, created by
Jonathan Druart
on 2015-09-25 15:34:12 UTC
(
hide
)
Description:
Bug 14899: DB changes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-09-25 15:34:12 UTC
Size:
5.88 KB
patch
obsolete
>From 2430b5bc249ce4ed2dfef1fb88706ebc83a4cdb7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 25 Sep 2015 16:06:07 +0100 >Subject: [PATCH] Bug 14899: DB changes > >This patch applies several changes to the DB structure introduced by >the previous ES patch set: > >1/ Add a search_field.label column >=> It will be easier to understand what the search_field does. >Indeed, some are not user friendly: acqdate, an, pl, ff8-23, ln, etc. >TODO later: Update the labels with correct values (at the moment >label=name) > >2/ Update the foreign key search_marc_to_field.search_marc_map_id with >on delete cascase. This will permit to automatically remove the entries >in search_marc_to_field when they are deleted in search_marc_map. > >3/ Remove the index_name_2 unique constraint on the search_marc_map table. >I don't understand how this could be useful, it was defined like (index_name, >marc_type, marc_field), so it means a mapping cannot be defined twice with >different values for facet, suggestible and sort. >This limitation does not seem to make sense. >Robin, please correct me if I am wrong :) >--- > Koha/Schema/Result/SearchField.pm | 12 ++++++++++-- > Koha/Schema/Result/SearchMarcMap.pm | 22 ++-------------------- > Koha/Schema/Result/SearchMarcToField.pm | 6 +++--- > installer/data/mysql/updatedatabase.pl | 23 +++++++++++++++++++++++ > 4 files changed, 38 insertions(+), 25 deletions(-) > >diff --git a/Koha/Schema/Result/SearchField.pm b/Koha/Schema/Result/SearchField.pm >index 38d299c..ce76534 100644 >--- a/Koha/Schema/Result/SearchField.pm >+++ b/Koha/Schema/Result/SearchField.pm >@@ -37,6 +37,12 @@ __PACKAGE__->table("search_field"); > > the name of the field as it will be stored in the search engine > >+=head2 label >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ > =head2 type > > data_type: 'enum' >@@ -52,6 +58,8 @@ __PACKAGE__->add_columns( > { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, > "name", > { data_type => "varchar", is_nullable => 0, size => 255 }, >+ "label", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, > "type", > { > data_type => "enum", >@@ -114,8 +122,8 @@ Composing rels: L</search_marc_to_fields> -> search_marc_map > __PACKAGE__->many_to_many("search_marc_maps", "search_marc_to_fields", "search_marc_map"); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-09-01 16:56:47 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VN1BPJJTnr7p+I2bRZoBEA >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-09-25 15:21:43 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HD0m5hWYi/GXgz1rvk+Ipw > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/Koha/Schema/Result/SearchMarcMap.pm b/Koha/Schema/Result/SearchMarcMap.pm >index cb5cd55..304c4f0 100644 >--- a/Koha/Schema/Result/SearchMarcMap.pm >+++ b/Koha/Schema/Result/SearchMarcMap.pm >@@ -115,24 +115,6 @@ __PACKAGE__->add_columns( > > __PACKAGE__->set_primary_key("id"); > >-=head1 UNIQUE CONSTRAINTS >- >-=head2 C<index_name_2> >- >-=over 4 >- >-=item * L</index_name> >- >-=item * L</marc_type> >- >-=item * L</marc_field> >- >-=back >- >-=cut >- >-__PACKAGE__->add_unique_constraint("index_name_2", ["index_name", "marc_type", "marc_field"]); >- > =head1 RELATIONS > > =head2 search_marc_to_fields >@@ -161,8 +143,8 @@ Composing rels: L</search_marc_to_fields> -> search_field > __PACKAGE__->many_to_many("search_fields", "search_marc_to_fields", "search_field"); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-09-01 16:56:47 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vo1uboO+iKCunqfpetswDg >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-09-25 15:20:52 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:o579otqUGA8XhO+NYv99dw > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/Koha/Schema/Result/SearchMarcToField.pm b/Koha/Schema/Result/SearchMarcToField.pm >index c000c41..8daccab 100644 >--- a/Koha/Schema/Result/SearchMarcToField.pm >+++ b/Koha/Schema/Result/SearchMarcToField.pm >@@ -87,12 +87,12 @@ __PACKAGE__->belongs_to( > "search_marc_map", > "Koha::Schema::Result::SearchMarcMap", > { id => "search_marc_map_id" }, >- { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-06-10 14:32:07 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZNdjnjdGpK+5P478RkCWnA >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-09-25 15:19:43 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:h9oY2xOGibcnsriEfcFe8A > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 38fbc5d..a627a0c 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -9877,6 +9877,29 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do(q| >+ ALTER TABLE search_marc_to_field DROP FOREIGN KEY search_marc_to_field_ibfk_1 >+ |); >+ $dbh->do(q| >+ ALTER TABLE search_marc_to_field >+ ADD CONSTRAINT search_marc_to_field_ibfk_1 FOREIGN KEY (`search_marc_map_id`) REFERENCES `search_marc_map` (`id`) ON DELETE CASCADE ON UPDATE CASCADE >+ |); >+ $dbh->do(q| >+ ALTER TABLE search_marc_map DROP KEY index_name_2 >+ |); >+ $dbh->do(q| >+ ALTER TABLE search_field ADD COLUMN label VARCHAR(255) AFTER name >+ |); >+ $dbh->do(q| >+ UPDATE search_field SET label=name >+ |); >+ >+ print "Upgrade to $DBversion done (Bug 12478 - set up elasticsearch tables)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >2.1.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 14899
:
42882
|
42883
|
42884
|
42885
|
42886
|
43054
|
43055
|
43056
|
43057
|
43058
|
43099
|
43353
|
43354
|
43355
|
50995
|
50996
|
50997
|
55915
|
55916
|
55917
|
55918
|
55957
|
55958
|
55959
|
55960
|
56182
|
56183
|
56194
|
56195
|
56196
|
56197
|
56198
|
56199