From 5efe4337862f07ab81162e55f8259d1f3d2cff30 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 17 Mar 2017 11:54:57 -0300 Subject: [PATCH] Bug 18231: Make sure we will not add the column twice --- Koha/Schema/Result/BorrowerAttributeType.pm | 4 ++-- Koha/Schema/Result/Issue.pm | 4 ++-- Koha/Schema/Result/Issuingrule.pm | 4 ++-- Koha/Schema/Result/OldIssue.pm | 4 ++-- Koha/Schema/Result/SearchField.pm | 8 ++++---- .../mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.perl | 11 +++++++++++ .../mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.sql | 3 --- 7 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.perl delete mode 100644 installer/data/mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.sql diff --git a/Koha/Schema/Result/BorrowerAttributeType.pm b/Koha/Schema/Result/BorrowerAttributeType.pm index 47fc12f..f522514 100644 --- a/Koha/Schema/Result/BorrowerAttributeType.pm +++ b/Koha/Schema/Result/BorrowerAttributeType.pm @@ -154,8 +154,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-04-25 18:09:15 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KzCA3jRyp/uqYdrHFXaw7Q +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-17 11:43:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0jCQN4xSJYbQC5e7fGn5WQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm index 0144a86..6a65d1b 100644 --- a/Koha/Schema/Result/Issue.pm +++ b/Koha/Schema/Result/Issue.pm @@ -222,8 +222,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2015-11-04 12:00:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kREecsHr6wZPiokS946BHw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-17 11:43:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zGLKwoUmq4pcvY16ei3VPg __PACKAGE__->belongs_to( "borrower", diff --git a/Koha/Schema/Result/Issuingrule.pm b/Koha/Schema/Result/Issuingrule.pm index b1fb2f1..b8e0024 100644 --- a/Koha/Schema/Result/Issuingrule.pm +++ b/Koha/Schema/Result/Issuingrule.pm @@ -330,8 +330,8 @@ __PACKAGE__->add_unique_constraint( ); -# Created by DBIx::Class::Schema::Loader v0.07045 @ 2017-03-08 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:714V5KtlVyeDUidAdc2m/g +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-17 11:43:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3K9yYzzg9IYRAuxSXd7CPg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/OldIssue.pm b/Koha/Schema/Result/OldIssue.pm index 5f8491f..73e4e98 100644 --- a/Koha/Schema/Result/OldIssue.pm +++ b/Koha/Schema/Result/OldIssue.pm @@ -207,8 +207,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2015-04-23 13:04:51 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9GdzytyInRcFZns/q0qb3Q +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-17 11:43:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yTyCAau9EZHBgdqN4Ptljg sub koha_objects_class { 'Koha::Old::Checkouts'; diff --git a/Koha/Schema/Result/SearchField.pm b/Koha/Schema/Result/SearchField.pm index 09a3b6f..9c9e130 100644 --- a/Koha/Schema/Result/SearchField.pm +++ b/Koha/Schema/Result/SearchField.pm @@ -48,7 +48,7 @@ the human readable name of the field, for display =head2 type data_type: 'enum' - extra: {list => ["string","date","number","boolean","sum"]} + extra: {list => ["","string","date","number","boolean","sum"]} is_nullable: 0 what type of data this holds, relevant when storing it in the search engine @@ -65,7 +65,7 @@ __PACKAGE__->add_columns( "type", { data_type => "enum", - extra => { list => ["string", "date", "number", "boolean", "sum"] }, + extra => { list => ["", "string", "date", "number", "boolean", "sum"] }, is_nullable => 0, }, ); @@ -114,8 +114,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-10-12 16:41:47 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4MJO9216VF37w7PlWCcBKg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-03-17 11:41:40 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VxltkYAqLdc89K4p7j7n5Q __PACKAGE__->many_to_many("search_marc_maps", "search_marc_to_fields", "search_marc_map"); diff --git a/installer/data/mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.perl b/installer/data/mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.perl new file mode 100644 index 0000000..8974137 --- /dev/null +++ b/installer/data/mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.perl @@ -0,0 +1,11 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + unless ( column_exists( 'issuingrules', 'issuingrules_id' ) ) { + $dbh->do(q|ALTER TABLE `issuingrules` DROP PRIMARY KEY|); + $dbh->do(q|ALTER TABLE `issuingrules` ADD `issuingrules_id` INT( 11 ) NOT NULL auto_increment PRIMARY KEY FIRST|); + $dbh->do(q|ALTER TABLE `issuingrules` ADD CONSTRAINT UNIQUE `issuingrules_id` (`branchcode`,`categorycode`,`itemtype`)|); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 18231 - Add issuingrules.issuingrules_id)\n"; +} diff --git a/installer/data/mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.sql b/installer/data/mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.sql deleted file mode 100644 index a7cd8a7..0000000 --- a/installer/data/mysql/atomicupdate/Bug-18231-id_to_ussingrules_table.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE `issuingrules` DROP PRIMARY KEY; -ALTER TABLE `issuingrules` ADD `issuingrules_id` INT( 11 ) NOT NULL auto_increment PRIMARY KEY FIRST; -ALTER TABLE `issuingrules` ADD CONSTRAINT UNIQUE `issuingrules_id` (`branchcode`,`categorycode`,`itemtype`); -- 2.9.3