Bug 18925: DBRev 18.12.00.020
authorNick Clemens <nick@bywatersolutions.com>
Tue, 5 Mar 2019 20:59:07 +0000 (20:59 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 6 Mar 2019 12:26:18 +0000 (12:26 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Koha.pm
Koha/Schema/Result/Branch.pm
Koha/Schema/Result/Category.pm
Koha/Schema/Result/DefaultBranchCircRule.pm
Koha/Schema/Result/DefaultCircRule.pm
Koha/Schema/Result/Issuingrule.pm
installer/data/mysql/atomicupdate/bug_18925.perl [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index a5a778c..a30cf37 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 = "18.12.00.019";
+$VERSION = "18.12.00.020";
 
 sub version {
     return $VERSION;
index d881685..576de64 100644 (file)
@@ -301,21 +301,6 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
-=head2 branch_borrower_circ_rules
-
-Type: has_many
-
-Related object: L<Koha::Schema::Result::BranchBorrowerCircRule>
-
-=cut
-
-__PACKAGE__->has_many(
-  "branch_borrower_circ_rules",
-  "Koha::Schema::Result::BranchBorrowerCircRule",
-  { "foreign.branchcode" => "self.branchcode" },
-  { cascade_copy => 0, cascade_delete => 0 },
-);
-
 =head2 branch_item_rules
 
 Type: has_many
@@ -677,8 +662,8 @@ __PACKAGE__->has_many(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-01-03 16:10:04
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WyXH3sMlyuJIx0fd31RswA
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:42:53
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nArzlMOpUO6oVOAZUgzSRg
 
 __PACKAGE__->add_columns(
     '+pickup_location' => { is_boolean => 1 }
index 1b61c33..7dc10ff 100644 (file)
@@ -221,21 +221,6 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
-=head2 branch_borrower_circ_rules
-
-Type: has_many
-
-Related object: L<Koha::Schema::Result::BranchBorrowerCircRule>
-
-=cut
-
-__PACKAGE__->has_many(
-  "branch_borrower_circ_rules",
-  "Koha::Schema::Result::BranchBorrowerCircRule",
-  { "foreign.categorycode" => "self.categorycode" },
-  { cascade_copy => 0, cascade_delete => 0 },
-);
-
 =head2 categories_branches
 
 Type: has_many
@@ -266,24 +251,9 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
-=head2 default_borrower_circ_rule
-
-Type: might_have
-
-Related object: L<Koha::Schema::Result::DefaultBorrowerCircRule>
-
-=cut
-
-__PACKAGE__->might_have(
-  "default_borrower_circ_rule",
-  "Koha::Schema::Result::DefaultBorrowerCircRule",
-  { "foreign.categorycode" => "self.categorycode" },
-  { cascade_copy => 0, cascade_delete => 0 },
-);
-
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-05 14:29:17
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yvHcgnSv1RXNMXJixVtt0Q
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:42:53
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XR5anXl3qCAm/Fa/l+zYpQ
 
 
 # You can replace this text with custom content, and it will be preserved on regeneration
index 776b0e4..e3bb128 100644 (file)
@@ -30,16 +30,6 @@ __PACKAGE__->table("default_branch_circ_rules");
   is_nullable: 0
   size: 10
 
-=head2 maxissueqty
-
-  data_type: 'integer'
-  is_nullable: 1
-
-=head2 maxonsiteissueqty
-
-  data_type: 'integer'
-  is_nullable: 1
-
 =head2 holdallowed
 
   data_type: 'tinyint'
@@ -63,10 +53,6 @@ __PACKAGE__->table("default_branch_circ_rules");
 __PACKAGE__->add_columns(
   "branchcode",
   { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
-  "maxissueqty",
-  { data_type => "integer", is_nullable => 1 },
-  "maxonsiteissueqty",
-  { data_type => "integer", is_nullable => 1 },
   "holdallowed",
   { data_type => "tinyint", is_nullable => 1 },
   "hold_fulfillment_policy",
@@ -110,8 +96,8 @@ __PACKAGE__->belongs_to(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-04-29 10:32:00
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wnrxD1/tp8X01YHmys02lg
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:42:53
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SYfKl5LgCoDZVhPooF55SA
 
 
 # You can replace this text with custom content, and it will be preserved on regeneration
index 355f4ea..4d34b1c 100644 (file)
@@ -30,16 +30,6 @@ __PACKAGE__->table("default_circ_rules");
   extra: {list => ["singleton"]}
   is_nullable: 0
 
-=head2 maxissueqty
-
-  data_type: 'integer'
-  is_nullable: 1
-
-=head2 maxonsiteissueqty
-
-  data_type: 'integer'
-  is_nullable: 1
-
 =head2 holdallowed
 
   data_type: 'integer'
@@ -68,10 +58,6 @@ __PACKAGE__->add_columns(
     extra => { list => ["singleton"] },
     is_nullable => 0,
   },
-  "maxissueqty",
-  { data_type => "integer", is_nullable => 1 },
-  "maxonsiteissueqty",
-  { data_type => "integer", is_nullable => 1 },
   "holdallowed",
   { data_type => "integer", is_nullable => 1 },
   "hold_fulfillment_policy",
@@ -98,8 +84,8 @@ __PACKAGE__->add_columns(
 __PACKAGE__->set_primary_key("singleton");
 
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-04-29 10:32:00
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fqBrj0c9h9c0eBlC0kG51w
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:42:53
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mrebGRlc4MORi6OtUk8NyA
 
 
 # You can replace this text with custom content, and it will be preserved on regeneration
index 187e463..6b50beb 100644 (file)
@@ -97,16 +97,6 @@ __PACKAGE__->table("issuingrules");
   data_type: 'integer'
   is_nullable: 1
 
-=head2 maxissueqty
-
-  data_type: 'integer'
-  is_nullable: 1
-
-=head2 maxonsiteissueqty
-
-  data_type: 'integer'
-  is_nullable: 1
-
 =head2 issuelength
 
   data_type: 'integer'
@@ -255,10 +245,6 @@ __PACKAGE__->add_columns(
   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
   "accountsent",
   { data_type => "integer", is_nullable => 1 },
-  "maxissueqty",
-  { data_type => "integer", is_nullable => 1 },
-  "maxonsiteissueqty",
-  { data_type => "integer", is_nullable => 1 },
   "issuelength",
   { data_type => "integer", is_nullable => 1 },
   "lengthunit",
@@ -328,8 +314,8 @@ __PACKAGE__->add_columns(
 __PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
 
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-01-04 03:06:35
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:slPyHZs0YvOKev3cAxdDJQ
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:49:11
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6bPX0BRWWQZrWFun3GP86Q
 
 
 # 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_18925.perl b/installer/data/mysql/atomicupdate/bug_18925.perl
deleted file mode 100644 (file)
index 810901b..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-$DBversion = 'XXX';  # will be replaced by the RM
-if( CheckVersion( $DBversion ) ) {
-    if ( TableExists( 'branch_borrower_circ_rules' ) ) {
-        if ( column_exists( 'branch_borrower_circ_rules', 'maxissueqty' ) ) {
-            $dbh->do("
-                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-                SELECT categorycode, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
-                FROM branch_borrower_circ_rules
-            ");
-            $dbh->do("
-                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-                SELECT categorycode, branchcode, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
-                FROM branch_borrower_circ_rules
-            ");
-            $dbh->do("DROP TABLE branch_borrower_circ_rules");
-        }
-    }
-
-    if ( TableExists( 'default_borrower_circ_rules' ) ) {
-        if ( column_exists( 'default_borrower_circ_rules', 'maxissueqty' ) ) {
-            $dbh->do("
-                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-                SELECT categorycode, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
-                FROM default_borrower_circ_rules
-            ");
-            $dbh->do("
-                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-                SELECT categorycode, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
-                FROM default_borrower_circ_rules
-            ");
-            $dbh->do("DROP TABLE default_borrower_circ_rules");
-        }
-    }
-
-    if ( column_exists( 'default_circ_rules', 'maxissueqty' ) ) {
-        $dbh->do("
-            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-            SELECT NULL, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
-            FROM default_circ_rules
-        ");
-        $dbh->do("
-            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-            SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
-            FROM default_circ_rules
-        ");
-        $dbh->do("ALTER TABLE default_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
-    }
-
-    if ( column_exists( 'default_branch_circ_rules', 'maxissueqty' ) ) {
-        $dbh->do("
-            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-            SELECT NULL, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
-            FROM default_branch_circ_rules
-        ");
-        $dbh->do("
-            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-            SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
-            FROM default_branch_circ_rules
-        ");
-        $dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
-    }
-
-    if ( column_exists( 'issuingrules', 'maxissueqty' ) ) {
-        $dbh->do("
-            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-            SELECT IF(categorycode='*', NULL, categorycode),
-                   IF(branchcode='*', NULL, branchcode),
-                   IF(itemtype='*', NULL, itemtype),
-                   'maxissueqty',
-                   COALESCE( maxissueqty, '' )
-            FROM issuingrules
-        ");
-        $dbh->do("
-            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
-            SELECT IF(categorycode='*', NULL, categorycode),
-                   IF(branchcode='*', NULL, branchcode),
-                   IF(itemtype='*', NULL, itemtype),
-                   'maxonsiteissueqty',
-                   COALESCE( maxonsiteissueqty, '' )
-            FROM issuingrules
-        ");
-        $dbh->do("ALTER TABLE issuingrules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
-    }
-
-    SetVersion( $DBversion );
-    print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n";
-}
index 64c3f89..07f16fa 100755 (executable)
@@ -17463,6 +17463,94 @@ if( CheckVersion( $DBversion ) ) {
     print "Upgrade to $DBversion done (Bug 21728 - Add 'Reserve Fee' to the account_offset_types table if missing)\n";
 }
 
+$DBversion = '18.12.00.020';
+if( CheckVersion( $DBversion ) ) {
+    if ( TableExists( 'branch_borrower_circ_rules' ) ) {
+        if ( column_exists( 'branch_borrower_circ_rules', 'maxissueqty' ) ) {
+            $dbh->do("
+                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+                SELECT categorycode, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
+                FROM branch_borrower_circ_rules
+            ");
+            $dbh->do("
+                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+                SELECT categorycode, branchcode, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
+                FROM branch_borrower_circ_rules
+            ");
+            $dbh->do("DROP TABLE branch_borrower_circ_rules");
+        }
+    }
+
+    if ( TableExists( 'default_borrower_circ_rules' ) ) {
+        if ( column_exists( 'default_borrower_circ_rules', 'maxissueqty' ) ) {
+            $dbh->do("
+                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+                SELECT categorycode, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
+                FROM default_borrower_circ_rules
+            ");
+            $dbh->do("
+                INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+                SELECT categorycode, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
+                FROM default_borrower_circ_rules
+            ");
+            $dbh->do("DROP TABLE default_borrower_circ_rules");
+        }
+    }
+
+    if ( column_exists( 'default_circ_rules', 'maxissueqty' ) ) {
+        $dbh->do("
+            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+            SELECT NULL, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
+            FROM default_circ_rules
+        ");
+        $dbh->do("
+            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+            SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
+            FROM default_circ_rules
+        ");
+        $dbh->do("ALTER TABLE default_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
+    }
+
+    if ( column_exists( 'default_branch_circ_rules', 'maxissueqty' ) ) {
+        $dbh->do("
+            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+            SELECT NULL, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
+            FROM default_branch_circ_rules
+        ");
+        $dbh->do("
+            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+            SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
+            FROM default_branch_circ_rules
+        ");
+        $dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
+    }
+
+    if ( column_exists( 'issuingrules', 'maxissueqty' ) ) {
+        $dbh->do("
+            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+            SELECT IF(categorycode='*', NULL, categorycode),
+                   IF(branchcode='*', NULL, branchcode),
+                   IF(itemtype='*', NULL, itemtype),
+                   'maxissueqty',
+                   COALESCE( maxissueqty, '' )
+            FROM issuingrules
+        ");
+        $dbh->do("
+            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+            SELECT IF(categorycode='*', NULL, categorycode),
+                   IF(branchcode='*', NULL, branchcode),
+                   IF(itemtype='*', NULL, itemtype),
+                   'maxonsiteissueqty',
+                   COALESCE( maxonsiteissueqty, '' )
+            FROM issuingrules
+        ");
+        $dbh->do("ALTER TABLE issuingrules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
+    }
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n";
+}
+
 # SEE bug 13068
 # if there is anything in the atomicupdate, read and execute it.