From 39138e860ce8e3eb54d2788ba32728baf03122c0 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 4 May 2020 08:35:59 +0100 Subject: [PATCH] Bug 17268: DBRev 19.12.00.084 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- .../atomicupdate/bug_17268_add_macros_table.perl | 27 --------------------- installer/data/mysql/updatedatabase.pl | 28 +++++++++++++++++++++- 3 files changed, 28 insertions(+), 29 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl diff --git a/Koha.pm b/Koha.pm index 28365c8128..d9dc6bafa3 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 = "19.12.00.083"; +$VERSION = "19.12.00.084"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl b/installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl deleted file mode 100644 index 04b9728e19..0000000000 --- a/installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl +++ /dev/null @@ -1,27 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - unless ( TableExists('advanced_editor_macros') ) { - $dbh->do(q| - CREATE TABLE advanced_editor_macros ( - id INT(11) NOT NULL AUTO_INCREMENT, - name varchar(80) NOT NULL, - macro longtext NULL, - borrowernumber INT(11) default NULL, - shared TINYINT(1) default 0, - PRIMARY KEY (id), - CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;| - ); - } - $dbh->do(q| - INSERT IGNORE INTO permissions (module_bit, code, description) - VALUES (9, 'create_shared_macros', 'Create public macros') - |); - $dbh->do(q| - INSERT IGNORE INTO permissions (module_bit, code, description) - VALUES (9, 'delete_shared_macros', 'Delete public macros') - |); - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 17682 - Add macros db table and permissions)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 042185af55..d28064a712 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -21963,10 +21963,36 @@ if( CheckVersion( $DBversion ) ) { WHERE category_name IN ('branches', 'itemtypes', 'cn_source') |); - # Always end with this (adjust the bug info) NewVersion( $DBversion, 17355, "Add is_system to authorised_value_categories table"); } +$DBversion = '19.12.00.084'; +if( CheckVersion( $DBversion ) ) { + unless ( TableExists('advanced_editor_macros') ) { + $dbh->do(q| + CREATE TABLE advanced_editor_macros ( + id INT(11) NOT NULL AUTO_INCREMENT, + name varchar(80) NOT NULL, + macro longtext NULL, + borrowernumber INT(11) default NULL, + shared TINYINT(1) default 0, + PRIMARY KEY (id), + CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;| + ); + } + $dbh->do(q| + INSERT IGNORE INTO permissions (module_bit, code, description) + VALUES (9, 'create_shared_macros', 'Create public macros') + |); + $dbh->do(q| + INSERT IGNORE INTO permissions (module_bit, code, description) + VALUES (9, 'delete_shared_macros', 'Delete public macros') + |); + + NewVersion( $DBversion, 17682, "Add macros db table and permissions"); +} + # 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/'; -- 2.11.4.GIT