From a2afebe115662ea5dcb8a98888f108d6730128ec Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 13 Jan 2017 12:24:39 +0000 Subject: [PATCH] Bug 14187 - DBRev 16.12.00.002 Signed-off-by: Kyle M Hall --- Koha.pm | 2 +- Koha/Schema/Result/Branchtransfer.pm | 24 ++++++++++++++++++++++-- installer/data/mysql/atomicupdate/14187.perl | 15 --------------- installer/data/mysql/updatedatabase.pl | 15 +++++++++++++++ 4 files changed, 38 insertions(+), 18 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/14187.perl diff --git a/Koha.pm b/Koha.pm index 3d03cba5e0..0682bd3c3b 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "16.12.00.001"; +$VERSION = "16.12.00.002"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Branchtransfer.pm b/Koha/Schema/Result/Branchtransfer.pm index 1976ffd402..9c5b76b959 100644 --- a/Koha/Schema/Result/Branchtransfer.pm +++ b/Koha/Schema/Result/Branchtransfer.pm @@ -23,6 +23,12 @@ __PACKAGE__->table("branchtransfers"); =head1 ACCESSORS +=head2 branchtransfer_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + =head2 itemnumber data_type: 'integer' @@ -66,6 +72,8 @@ __PACKAGE__->table("branchtransfers"); =cut __PACKAGE__->add_columns( + "branchtransfer_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "itemnumber", { data_type => "integer", @@ -105,6 +113,18 @@ __PACKAGE__->add_columns( { data_type => "mediumtext", is_nullable => 1 }, ); +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("branchtransfer_id"); + =head1 RELATIONS =head2 frombranch @@ -153,8 +173,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NPbH+5o2BVPj8yeoUqEavw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-01-13 12:22:24 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8cnatLrGkNwyTo35PCOm2A # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/14187.perl b/installer/data/mysql/atomicupdate/14187.perl deleted file mode 100644 index 5a7fa67f40..0000000000 --- a/installer/data/mysql/atomicupdate/14187.perl +++ /dev/null @@ -1,15 +0,0 @@ -$DBversion = '16.12.00.XXX'; -if ( CheckVersion($DBversion) ) { - unless (column_exists( 'branchtransfers', 'branchtransfer_id' ) - and index_exists( 'branchtransfers', 'PRIMARY' ) ) - { - $dbh->do( - "ALTER TABLE branchtransfers - ADD COLUMN branchtransfer_id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (branchtransfer_id);" - ); - } - - # Always end with this (adjust the bug info) - SetVersion($DBversion); - print "Upgrade to $DBversion done (Bug 14187: branchtransfer needs a primary key (id) for DBIx and common sense.)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9f29a39a77..87d71e3e1f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -13766,6 +13766,21 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = '16.12.00.002'; +if ( CheckVersion($DBversion) ) { + unless (column_exists( 'branchtransfers', 'branchtransfer_id' ) + and index_exists( 'branchtransfers', 'PRIMARY' ) ) + { + $dbh->do( + "ALTER TABLE branchtransfers + ADD COLUMN branchtransfer_id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (branchtransfer_id);" + ); + } + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 14187 - branchtransfer needs a primary key (id) for DBIx and common sense.)\n"; +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.11.4.GIT