Bug 13535: DBRev 20.06.00.046

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-10-08 14:14:33 +00:00
parent ffd10c34e2
commit 48f9692edd
3 changed files with 17 additions and 17 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.045";
$VERSION = "20.06.00.046";
sub version {
return $VERSION;

View File

@ -1,16 +0,0 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
unless ( foreign_key_exists( 'alert', 'alert_ibfk_1' ) ) {
$dbh->do(q|
DELETE a FROM alert a
LEFT JOIN borrowers b ON a.borrowernumber=b.borrowernumber
WHERE b.borrowernumber IS NULL
|);
$dbh->do(
qq{
ALTER TABLE alert ADD CONSTRAINT alert_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON UPDATE CASCADE ON DELETE CASCADE
}
);
}
NewVersion( $DBversion, 13535, "Add FK constraint on borrowernumber to alert table");
}

View File

@ -22953,6 +22953,22 @@ if( CheckVersion( $DBversion ) ) {
NewVersion( $DBversion, 22417, "Add new table background_jobs");
}
$DBversion = '20.06.00.046';
if( CheckVersion( $DBversion ) ) {
unless ( foreign_key_exists( 'alert', 'alert_ibfk_1' ) ) {
$dbh->do(q|
DELETE a FROM alert a
LEFT JOIN borrowers b ON a.borrowernumber=b.borrowernumber
WHERE b.borrowernumber IS NULL
|);
$dbh->do(q|
ALTER TABLE alert
ADD CONSTRAINT alert_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON UPDATE CASCADE ON DELETE CASCADE
|);
}
NewVersion( $DBversion, 13535, "Add FK constraint on borrowernumber to alert table" );
}
# 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/';