From 2578d8cd968fe00d5e413ce7911f7e14e77cf951 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 21 Oct 2016 17:44:59 +0000 Subject: [PATCH] Bug 5670 - DBRev 16.06.00.036 Signed-off-by: Kyle M Hall --- Koha.pm | 2 +- Koha/Schema/Result/Borrower.pm | 8 +- Koha/Schema/Result/HouseboundRole.pm | 4 +- .../mysql/atomicupdate/housebound_tables.sql | 63 ---------------- installer/data/mysql/updatedatabase.pl | 73 +++++++++++++++++++ 5 files changed, 80 insertions(+), 70 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/housebound_tables.sql diff --git a/Koha.pm b/Koha.pm index 5a1135fc72..f9ce59b2e8 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.06.00.035"; +$VERSION = "16.06.00.036"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index b656a8c708..ad2664ecc0 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -419,7 +419,7 @@ __PACKAGE__->table("borrowers"); data_type: 'timestamp' datetime_undef_if_invalid: 1 default_value: current_timestamp - is_nullable: 1 + is_nullable: 0 =head2 lastseen @@ -608,7 +608,7 @@ __PACKAGE__->add_columns( data_type => "timestamp", datetime_undef_if_invalid => 1, default_value => \"current_timestamp", - is_nullable => 1, + is_nullable => 0, }, "lastseen", { @@ -1304,8 +1304,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2016-10-13 07:29:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gTAVqirjg5ZckpVtRTXHOQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-21 18:19:46 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rbkXombY7fZnZJ3CvHruUA __PACKAGE__->belongs_to( "guarantor", diff --git a/Koha/Schema/Result/HouseboundRole.pm b/Koha/Schema/Result/HouseboundRole.pm index d6abe4997a..c5fbca120e 100644 --- a/Koha/Schema/Result/HouseboundRole.pm +++ b/Koha/Schema/Result/HouseboundRole.pm @@ -82,8 +82,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2016-10-13 07:29:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oRdlsug404i4vErycF4bgg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-21 18:20:25 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SU7khVgiUf1OVvaFpKaFPA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/housebound_tables.sql b/installer/data/mysql/atomicupdate/housebound_tables.sql deleted file mode 100644 index e9e4151d3d..0000000000 --- a/installer/data/mysql/atomicupdate/housebound_tables.sql +++ /dev/null @@ -1,63 +0,0 @@ -CREATE TABLE IF NOT EXISTS `housebound_profile` ( - `borrowernumber` int(11) NOT NULL, -- Number of the borrower associated with this profile. - `day` text NOT NULL, -- The preferred day of the week for delivery. - `frequency` text NOT NULL, -- The Authorised_Value definining the pattern for delivery. - `fav_itemtypes` text default NULL, -- Free text describing preferred itemtypes. - `fav_subjects` text default NULL, -- Free text describing preferred subjects. - `fav_authors` text default NULL, -- Free text describing preferred authors. - `referral` text default NULL, -- Free text indicating how the borrower was added to the service. - `notes` text default NULL, -- Free text for additional notes. - PRIMARY KEY (`borrowernumber`), - CONSTRAINT `housebound_profile_bnfk` - FOREIGN KEY (`borrowernumber`) - REFERENCES `borrowers` (`borrowernumber`) - ON UPDATE CASCADE ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `housebound_visit` ( - `id` int(11) NOT NULL auto_increment, -- ID of the visit. - `borrowernumber` int(11) NOT NULL, -- Number of the borrower, & the profile, linked to this visit. - `appointment_date` date default NULL, -- Date of visit. - `day_segment` varchar(10), -- Rough time frame: 'morning', 'afternoon' 'evening' - `chooser_brwnumber` int(11) default NULL, -- Number of the borrower to choose items for delivery. - `deliverer_brwnumber` int(11) default NULL, -- Number of the borrower to deliver items. - PRIMARY KEY (`id`), - CONSTRAINT `houseboundvisit_bnfk` - FOREIGN KEY (`borrowernumber`) - REFERENCES `housebound_profile` (`borrowernumber`) - ON UPDATE CASCADE ON DELETE CASCADE, - CONSTRAINT `houseboundvisit_bnfk_1` - FOREIGN KEY (`chooser_brwnumber`) - REFERENCES `borrowers` (`borrowernumber`) - ON UPDATE CASCADE ON DELETE CASCADE, - CONSTRAINT `houseboundvisit_bnfk_2` - FOREIGN KEY (`deliverer_brwnumber`) - REFERENCES `borrowers` (`borrowernumber`) - ON UPDATE CASCADE ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `housebound_role` ( - `borrowernumber_id` int(11) NOT NULL, -- borrowernumber link - `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0, -- set to 1 to indicate this patron is a housebound chooser volunteer - `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0, -- set to 1 to indicate this patron is a housebound deliverer volunteer - PRIMARY KEY (`borrowernumber_id`), - CONSTRAINT `houseboundrole_bnfk` - FOREIGN KEY (`borrowernumber_id`) - REFERENCES `borrowers` (`borrowernumber`) - ON UPDATE CASCADE ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -INSERT IGNORE INTO systempreferences - (variable,value,options,explanation,type) VALUES - ('HouseboundModule',0,'', - 'If ON, enable housebound module functionality.','YesNo'); - --- Install in new authorised value category table - -INSERT IGNORE INTO authorised_value_categories( category_name ) VALUES - ('HSBND_FREQ'); - --- Then add mandatory authorised values - -INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES - ('HSBND_FREQ','EW','Every week'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a3fb7dbf53..6e275103b9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -13206,6 +13206,79 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = '16.06.00.036'; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + CREATE TABLE IF NOT EXISTS `housebound_profile` ( + `borrowernumber` int(11) NOT NULL, -- Number of the borrower associated with this profile. + `day` text NOT NULL, -- The preferred day of the week for delivery. + `frequency` text NOT NULL, -- The Authorised_Value definining the pattern for delivery. + `fav_itemtypes` text default NULL, -- Free text describing preferred itemtypes. + `fav_subjects` text default NULL, -- Free text describing preferred subjects. + `fav_authors` text default NULL, -- Free text describing preferred authors. + `referral` text default NULL, -- Free text indicating how the borrower was added to the service. + `notes` text default NULL, -- Free text for additional notes. + PRIMARY KEY (`borrowernumber`), + CONSTRAINT `housebound_profile_bnfk` + FOREIGN KEY (`borrowernumber`) + REFERENCES `borrowers` (`borrowernumber`) + ON UPDATE CASCADE ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + }); + $dbh->do(q{ + CREATE TABLE IF NOT EXISTS `housebound_visit` ( + `id` int(11) NOT NULL auto_increment, -- ID of the visit. + `borrowernumber` int(11) NOT NULL, -- Number of the borrower, & the profile, linked to this visit. + `appointment_date` date default NULL, -- Date of visit. + `day_segment` varchar(10), -- Rough time frame: 'morning', 'afternoon' 'evening' + `chooser_brwnumber` int(11) default NULL, -- Number of the borrower to choose items for delivery. + `deliverer_brwnumber` int(11) default NULL, -- Number of the borrower to deliver items. + PRIMARY KEY (`id`), + CONSTRAINT `houseboundvisit_bnfk` + FOREIGN KEY (`borrowernumber`) + REFERENCES `housebound_profile` (`borrowernumber`) + ON UPDATE CASCADE ON DELETE CASCADE, + CONSTRAINT `houseboundvisit_bnfk_1` + FOREIGN KEY (`chooser_brwnumber`) + REFERENCES `borrowers` (`borrowernumber`) + ON UPDATE CASCADE ON DELETE CASCADE, + CONSTRAINT `houseboundvisit_bnfk_2` + FOREIGN KEY (`deliverer_brwnumber`) + REFERENCES `borrowers` (`borrowernumber`) + ON UPDATE CASCADE ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + }); + $dbh->do(q{ + CREATE TABLE IF NOT EXISTS `housebound_role` ( + `borrowernumber_id` int(11) NOT NULL, -- borrowernumber link + `housebound_chooser` tinyint(1) NOT NULL DEFAULT 0, -- set to 1 to indicate this patron is a housebound chooser volunteer + `housebound_deliverer` tinyint(1) NOT NULL DEFAULT 0, -- set to 1 to indicate this patron is a housebound deliverer volunteer + PRIMARY KEY (`borrowernumber_id`), + CONSTRAINT `houseboundrole_bnfk` + FOREIGN KEY (`borrowernumber_id`) + REFERENCES `borrowers` (`borrowernumber`) + ON UPDATE CASCADE ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + }); + $dbh->do(q{ + INSERT IGNORE INTO systempreferences + (variable,value,options,explanation,type) VALUES + ('HouseboundModule',0,'', + 'If ON, enable housebound module functionality.','YesNo'); + }); + $dbh->do(q{ + INSERT IGNORE INTO authorised_value_categories( category_name ) VALUES + ('HSBND_FREQ'); + }); + $dbh->do(q{ + INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES + ('HSBND_FREQ','EW','Every week'); + }); + + print "Upgrade to $DBversion done (Bug 5670 - Housebound Readers Module)\n"; + SetVersion($DBversion); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 -- 2.39.2