Bug 5670 - DBRev 16.06.00.036
authorKyle M Hall <kyle@bywatersolutions.com>
Fri, 21 Oct 2016 17:44:59 +0000 (17:44 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 21 Oct 2016 18:20:44 +0000 (18:20 +0000)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Koha.pm
Koha/Schema/Result/Borrower.pm
Koha/Schema/Result/HouseboundRole.pm
installer/data/mysql/atomicupdate/housebound_tables.sql [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index 5a1135f..f9ce59b 100644 (file)
--- 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;
index b656a8c..ad2664e 100644 (file)
@@ -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</aqorder_users> -> 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",
index d6abe49..c5fbca1 100644 (file)
@@ -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 (file)
index e9e4151..0000000
+++ /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');
index a3fb7db..6e27510 100755 (executable)
@@ -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