From ba4a808015ac1e172983487e590b097469970355 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 9 Feb 2018 15:13:35 -0300 Subject: [PATCH] Bug 15707: DBRev 17.12.00.007 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../mysql/atomicupdate/library_groups.sql | 13 ---------- installer/data/mysql/kohastructure.sql | 7 ++--- installer/data/mysql/updatedatabase.pl | 26 +++++++++++++++++++ 4 files changed, 31 insertions(+), 17 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/library_groups.sql diff --git a/Koha.pm b/Koha.pm index 47784e25be..d2c5707eef 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 = "17.12.00.006"; +$VERSION = "17.12.00.007"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/library_groups.sql b/installer/data/mysql/atomicupdate/library_groups.sql deleted file mode 100644 index f05e44fd59..0000000000 --- a/installer/data/mysql/atomicupdate/library_groups.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE library_groups ( - id INT(11) NOT NULL auto_increment, -- unique id for each group - parent_id INT(11) NULL DEFAULT NULL, -- if this is a child group, the id of the parent group - branchcode VARCHAR(10) NULL DEFAULT NULL, -- The branchcode of a branch belonging to the parent group - title VARCHAR(100) NULL DEFAULT NULL, -- Short description of the goup - description TEXT NULL DEFAULT NULL, -- Longer explanation of the group, if necessary - created_on TIMESTAMP NULL, -- Date and time of creation - updated_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Date and time of last - PRIMARY KEY id ( id ), - FOREIGN KEY (parent_id) REFERENCES library_groups(id) ON UPDATE CASCADE ON DELETE CASCADE, - FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON UPDATE CASCADE ON DELETE CASCADE, - UNIQUE( title ) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 77691e3d21..14e2d4d2d3 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4173,11 +4173,12 @@ CREATE TABLE library_groups ( branchcode VARCHAR(10) NULL DEFAULT NULL, -- The branchcode of a branch belonging to the parent group title VARCHAR(100) NULL DEFAULT NULL, -- Short description of the goup description TEXT NULL DEFAULT NULL, -- Longer explanation of the group, if necessary - created_on DATETIME NOT NULL, -- Date and time of creation - updated_on DATETIME NULL DEFAULT NULL, -- Date and time of last + created_on TIMESTAMP NULL, -- Date and time of creation + updated_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Date and time of last PRIMARY KEY id ( id ), FOREIGN KEY (parent_id) REFERENCES library_groups(id) ON UPDATE CASCADE ON DELETE CASCADE, - FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON UPDATE CASCADE ON DELETE CASCADE + FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON UPDATE CASCADE ON DELETE CASCADE, + UNIQUE( title ) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 57a1a00c47..f3ebe14d66 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -15220,6 +15220,32 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 17682 - Update URL for Google Scholar in OPACSearchForTitleIn)\n"; } +$DBversion = '17.12.00.007'; +if( CheckVersion( $DBversion ) ) { + + unless ( TableExists( 'library_groups' ) ) { + $dbh->do(q{ + CREATE TABLE library_groups ( + id INT(11) NOT NULL auto_increment, -- unique id for each group + parent_id INT(11) NULL DEFAULT NULL, -- if this is a child group, the id of the parent group + branchcode VARCHAR(10) NULL DEFAULT NULL, -- The branchcode of a branch belonging to the parent group + title VARCHAR(100) NULL DEFAULT NULL, -- Short description of the goup + description TEXT NULL DEFAULT NULL, -- Longer explanation of the group, if necessary + created_on TIMESTAMP NULL, -- Date and time of creation + updated_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Date and time of last + PRIMARY KEY id ( id ), + FOREIGN KEY (parent_id) REFERENCES library_groups(id) ON UPDATE CASCADE ON DELETE CASCADE, + FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON UPDATE CASCADE ON DELETE CASCADE, + UNIQUE( title ) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + }); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 15707 - Add new table library_groups)\n"; +} + + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.20.1