@@ -, +, @@ --- Koha/Schema/Result/OldReserve.pm | 8 ++++---- Koha/Schema/Result/Reserve.pm | 8 ++++---- .../bug_23133_item_level_holds.perl | 19 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 ++-- 4 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23133_item_level_holds.perl --- a/Koha/Schema/Result/OldReserve.pm +++ a/Koha/Schema/Result/OldReserve.pm @@ -137,7 +137,7 @@ __PACKAGE__->table("old_reserves"); is_nullable: 1 size: 10 -=head2 item_level_hold +=head2 item_level data_type: 'tinyint' default_value: 0 @@ -198,7 +198,7 @@ __PACKAGE__->add_columns( }, "itemtype", { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, - "item_level_hold", + "item_level", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); @@ -297,8 +297,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-06-17 07:24:39 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZgGAW7ODBby3hGNJ41eeMA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-06-17 15:35:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rQMv2lyDOGwH9gDqrzLdmA # You can replace this text with custom content, and it will be preserved on regeneration --- a/Koha/Schema/Result/Reserve.pm +++ a/Koha/Schema/Result/Reserve.pm @@ -141,7 +141,7 @@ __PACKAGE__->table("reserves"); is_nullable: 1 size: 10 -=head2 item_level_hold +=head2 item_level data_type: 'tinyint' default_value: 0 @@ -212,7 +212,7 @@ __PACKAGE__->add_columns( }, "itemtype", { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, - "item_level_hold", + "item_level", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); @@ -321,8 +321,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-06-17 07:24:39 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OMFqEWyKqFTcYj7vAFXy/g +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-06-17 15:35:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5rdCr4lZTl6JUrJ/LujZQA __PACKAGE__->belongs_to( "item", --- a/installer/data/mysql/atomicupdate/bug_23133_item_level_holds.perl +++ a/installer/data/mysql/atomicupdate/bug_23133_item_level_holds.perl @@ -0,0 +1,19 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + + if ( column_exists( 'reserves', 'item_level_hold' ) ) { + $dbh->do(q{ + ALTER TABLE reserves + CHANGE COLUMN `item_level_hold` `item_level` TINYINT(1) NOT NULL DEFAULT 0; + }); + } + if ( column_exists( 'old_reserves', 'item_level_hold' ) ) { + $dbh->do(q{ + ALTER TABLE old_reserves + CHANGE COLUMN `item_level_hold` `item_level` TINYINT(1) NOT NULL DEFAULT 0; + }); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 23133 - Rename reserves.item_level_hold for reserves.item_level)\n"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1882,7 +1882,7 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha `suspend` BOOLEAN NOT NULL DEFAULT 0, `suspend_until` DATETIME NULL DEFAULT NULL, `itemtype` VARCHAR(10) NULL DEFAULT NULL, -- If record level hold, the optional itemtype of the item the patron is requesting - `item_level_hold` BOOLEAN NOT NULL DEFAULT 0, -- Is the hpld placed at item level + `item_level` TINYINT(1) NOT NULL DEFAULT 0, -- Is the hold placed at item level PRIMARY KEY (`reserve_id`), KEY priorityfoundidx (priority,found), KEY `borrowernumber` (`borrowernumber`), @@ -1922,7 +1922,7 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b `suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no) `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely) `itemtype` VARCHAR(10) NULL DEFAULT NULL, -- If record level hold, the optional itemtype of the item the patron is requesting - `item_level_hold` BOOLEAN NOT NULL DEFAULT 0, -- Is the hpld placed at item level + `item_level` TINYINT(1) NOT NULL DEFAULT 0, -- Is the hold placed at item level PRIMARY KEY (`reserve_id`), KEY `old_reserves_borrowernumber` (`borrowernumber`), KEY `old_reserves_biblionumber` (`biblionumber`), --