Bug 22435: DBRev 21.06.00.013
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 4 Aug 2021 09:28:52 +0000 (09:28 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 4 Aug 2021 12:06:43 +0000 (14:06 +0200)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha.pm
installer/data/mysql/atomicupdate/bug_22435.perl [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index 77a3f81..173f3f2 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 = "21.06.00.012";
+$VERSION = "21.06.00.013";
 
 sub version {
     return $VERSION;
diff --git a/installer/data/mysql/atomicupdate/bug_22435.perl b/installer/data/mysql/atomicupdate/bug_22435.perl
deleted file mode 100644 (file)
index 2862574..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-$DBversion = 'XXX'; # will be replaced by the RM
-if( CheckVersion( $DBversion ) ) {
-    # Remove foreign key for offset types
-    if ( foreign_key_exists( 'account_offsets', 'account_offsets_ibfk_t' ) ) {
-        $dbh->do( "ALTER TABLE account_offsets DROP FOREIGN KEY account_offsets_ibfk_t" );
-    }
-
-    # Drop account_offset_types table
-    $dbh->do( "DROP TABLE IF EXISTS account_offset_types" );
-
-    # Update offset_types to 'CREATE' where appropriate
-    $dbh->do( "UPDATE account_offsets SET type = 'CREATE' WHERE type != 'OVERDUE_INCREASE' AND type != 'OVERDUE_DECREASE' AND ( debit_id IS NULL OR credit_id IS NULL)" );
-    $dbh->do( "UPDATE account_offsets SET amount = ABS(amount) WHERE type = 'CREATE'" );
-
-    # Update offset_types to 'APPLY' where appropriate
-    $dbh->do( "UPDATE account_offsets SET type = 'APPLY' WHERE type != 'OVERDUE_INCREASE' AND type != 'OVERDUE_DECREASE' AND type != 'CREATE' AND type != 'VOID'" );
-
-    # Update table to ENUM
-    $dbh->do(
-        q{
-            ALTER TABLE
-                `account_offsets`
-            MODIFY COLUMN
-                `type` enum(
-                    'CREATE',
-                    'APPLY',
-                    'VOID',
-                    'OVERDUE_INCREASE',
-                    'OVERDUE_DECREASE'
-                )
-            AFTER `debit_id`
-          }
-    );
-
-
-    NewVersion( $DBversion, 22435, "Update existing offsets");
-}
index fe2fe27..b326bcf 100755 (executable)
@@ -24542,6 +24542,44 @@ if( CheckVersion( $DBversion ) ) {
     NewVersion( $DBversion, 15067, "Add missing languages" );
 }
 
+$DBversion = '21.06.00.013';
+if( CheckVersion( $DBversion ) ) {
+    # Remove foreign key for offset types
+    if ( foreign_key_exists( 'account_offsets', 'account_offsets_ibfk_t' ) ) {
+        $dbh->do( "ALTER TABLE account_offsets DROP FOREIGN KEY account_offsets_ibfk_t" );
+    }
+
+    # Drop account_offset_types table
+    $dbh->do( "DROP TABLE IF EXISTS account_offset_types" );
+
+    # Update offset_types to 'CREATE' where appropriate
+    $dbh->do( "UPDATE account_offsets SET type = 'CREATE' WHERE type != 'OVERDUE_INCREASE' AND type != 'OVERDUE_DECREASE' AND ( debit_id IS NULL OR credit_id IS NULL)" );
+    $dbh->do( "UPDATE account_offsets SET amount = ABS(amount) WHERE type = 'CREATE'" );
+
+    # Update offset_types to 'APPLY' where appropriate
+    $dbh->do( "UPDATE account_offsets SET type = 'APPLY' WHERE type != 'OVERDUE_INCREASE' AND type != 'OVERDUE_DECREASE' AND type != 'CREATE' AND type != 'VOID'" );
+
+    # Update table to ENUM
+    $dbh->do(
+        q{
+            ALTER TABLE
+                `account_offsets`
+            MODIFY COLUMN
+                `type` enum(
+                    'CREATE',
+                    'APPLY',
+                    'VOID',
+                    'OVERDUE_INCREASE',
+                    'OVERDUE_DECREASE'
+                )
+            AFTER `debit_id`
+          }
+    );
+
+
+    NewVersion( $DBversion, 22435, "Update existing offsets");
+}
+
 # SEE bug 13068
 # if there is anything in the atomicupdate, read and execute it.
 my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';