From 3516e9a9f85e394e1ed683064823acf473ea2088 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Sat, 13 Oct 2018 07:47:12 -0300 Subject: [PATCH] Bug 20772: DBRev 18.06.00.041 Signed-off-by: Tomas Cohen Arazi --- Koha.pm | 2 +- Koha/Schema/Result/Illrequest.pm | 12 +++++++-- Koha/Schema/Result/Illrequestattribute.pm | 12 +++++++-- ...-add-price_paid_column_to_illrequests.perl | 10 ------- ...readonly-flag-to-illrequestattributes.perl | 11 -------- installer/data/mysql/updatedatabase.pl | 26 +++++++++++++++++++ 6 files changed, 47 insertions(+), 26 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_20772-add-price_paid_column_to_illrequests.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl diff --git a/Koha.pm b/Koha.pm index 7f769898fe..955dbf309f 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 = "18.06.00.040"; +$VERSION = "18.06.00.041"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm index 1b207ff002..3e8462c13b 100644 --- a/Koha/Schema/Result/Illrequest.pm +++ b/Koha/Schema/Result/Illrequest.pm @@ -97,6 +97,12 @@ __PACKAGE__->table("illrequests"); is_nullable: 1 size: 20 +=head2 price_paid + + data_type: 'varchar' + is_nullable: 1 + size: 20 + =head2 notesopac data_type: 'mediumtext' @@ -156,6 +162,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 500 }, "cost", { data_type => "varchar", is_nullable => 1, size => 20 }, + "price_paid", + { data_type => "varchar", is_nullable => 1, size => 20 }, "notesopac", { data_type => "mediumtext", is_nullable => 1 }, "notesstaff", @@ -231,8 +239,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Rh8DSs3xj3KRmyd7WNGDAg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-01 02:46:41 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MMKr4JAAAsNnFcQn9SPTcw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Illrequestattribute.pm b/Koha/Schema/Result/Illrequestattribute.pm index cb9cb182d7..b89de5bbd2 100644 --- a/Koha/Schema/Result/Illrequestattribute.pm +++ b/Koha/Schema/Result/Illrequestattribute.pm @@ -41,6 +41,12 @@ __PACKAGE__->table("illrequestattributes"); data_type: 'mediumtext' is_nullable: 0 +=head2 readonly + + data_type: 'tinyint' + default_value: 1 + is_nullable: 0 + =cut __PACKAGE__->add_columns( @@ -55,6 +61,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 0, size => 200 }, "value", { data_type => "mediumtext", is_nullable => 0 }, + "readonly", + { data_type => "tinyint", default_value => 1, is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -89,8 +97,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:X9SxZP1PGXTwDJ6lUkx8Fg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-05-17 09:17:53 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sFY1giVMz5AkXCPidhyGjw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/bug_20772-add-price_paid_column_to_illrequests.perl b/installer/data/mysql/atomicupdate/bug_20772-add-price_paid_column_to_illrequests.perl deleted file mode 100644 index f7207926ab..0000000000 --- a/installer/data/mysql/atomicupdate/bug_20772-add-price_paid_column_to_illrequests.perl +++ /dev/null @@ -1,10 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - - if( !column_exists( 'illrequests', 'price_paid' ) ) { - $dbh->do( "ALTER TABLE illrequests ADD COLUMN price_paid varchar(20) DEFAULT NULL AFTER 'cost'" ); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 20772 - Add illrequest.price_paid column)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl b/installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl deleted file mode 100644 index 7707bc55e8..0000000000 --- a/installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl +++ /dev/null @@ -1,11 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - - if( !column_exists( 'illrequestattributes', 'readonly' ) ) { - $dbh->do( "ALTER TABLE illrequestattributes ADD COLUMN readonly tinyint(1) NOT NULL DEFAULT 1 AFTER 'value'" ); - $dbh->do( "UPDATE illrequestattributes SET readonly = 1" ); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 20772 - Add illrequestattributes.readonly column)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 6469f511d0..2f48eff6e7 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -16644,6 +16644,32 @@ if( CheckVersion( $DBversion ) ) { SetVersion( $DBversion ); } +$DBversion = '18.06.00.041'; +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'illrequests', 'price_paid' ) ) { + $dbh->do(q{ + ALTER TABLE illrequests + ADD COLUMN price_paid varchar(20) DEFAULT NULL + AFTER cost + }); + } + + if( !column_exists( 'illrequestattributes', 'readonly' ) ) { + $dbh->do(q{ + ALTER TABLE illrequestattributes + ADD COLUMN readonly tinyint(1) NOT NULL DEFAULT 1 + AFTER value + }); + $dbh->do(q{ + UPDATE illrequestattributes SET readonly = 1 + }); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 20772 - Add illrequestattributes.readonly and illrequest.price_paid columns)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5