Bug 26145: DBRev 20.06.00.049

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-10-12 09:13:18 +00:00
parent 26eadaa7de
commit 3611a2cd68
3 changed files with 28 additions and 30 deletions

View File

@ -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 = "20.06.00.048";
$VERSION = "20.06.00.049";
sub version {
return $VERSION;

View File

@ -1,29 +0,0 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
if( !column_exists( 'biblioimages', 'itemnumber' ) ) {
$dbh->do(q|
ALTER TABLE biblioimages
ADD COLUMN itemnumber INT(11) DEFAULT NULL
AFTER biblionumber;
|);
$dbh->do(q|
ALTER TABLE biblioimages
ADD FOREIGN KEY bibliocoverimage_fk2 (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
|);
$dbh->do(q|
ALTER TABLE biblioimages MODIFY biblionumber INT(11) DEFAULT NULL
|)
}
NewVersion( $DBversion, 'XXXXX', "Add the biblioimages.itemnumber column");
if( !TableExists('cover_images') ) {
$dbh->do(q|
ALTER TABLE biblioimages RENAME cover_images
|);
}
# Always end with this (adjust the bug info)
NewVersion( $DBversion, "XXXXX", "Rename table biblioimages with cover_images");
}

View File

@ -23009,6 +23009,33 @@ if( CheckVersion( $DBversion ) ) {
NewVersion( $DBversion, 26529, "Remove blank default branch rules");
}
$DBversion = '20.06.00.049';
if( CheckVersion( $DBversion ) ) {
if( !column_exists( 'biblioimages', 'itemnumber' ) ) {
$dbh->do(q|
ALTER TABLE biblioimages
ADD COLUMN itemnumber INT(11) DEFAULT NULL
AFTER biblionumber;
|);
$dbh->do(q|
ALTER TABLE biblioimages
ADD FOREIGN KEY bibliocoverimage_fk2 (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
|);
$dbh->do(q|
ALTER TABLE biblioimages MODIFY biblionumber INT(11) DEFAULT NULL
|)
}
if( !TableExists('cover_images') ) {
$dbh->do(q|
ALTER TABLE biblioimages RENAME cover_images
|);
}
NewVersion( $DBversion, '26145', ["Add the biblioimages.itemnumber column", "Rename table biblioimages with cover_images"] );
}
# 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/';