Bug 16170: Update DB rev (3.22.06.003)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
parent
a839f0f77d
commit
4ebc3a2bca
2
Koha.pm
2
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 = "3.22.06.002";
|
||||
$VERSION = "3.22.06.003";
|
||||
|
||||
sub version {
|
||||
return $VERSION;
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use C4::Context;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $DBversion = "XXX";
|
||||
|
||||
# RM: Copy/paste from here, and uncomment
|
||||
|
||||
#if ( CheckVersion($DBversion) ) {
|
||||
# this should normally not be needed, but just in case
|
||||
my ( $cnt ) = $dbh->selectrow_array( q|
|
||||
SELECT COUNT(*) FROM items it
|
||||
LEFT JOIN biblio bi ON bi.biblionumber=it.biblionumber
|
||||
LEFT JOIN biblioitems bii USING (biblioitemnumber)
|
||||
WHERE bi.biblionumber IS NULL
|
||||
|);
|
||||
if( $cnt ) {
|
||||
print "WARNING: You have corrupted data in your items table!! The table contains $cnt references to biblio records that do not exist.\nPlease correct your data IMMEDIATELY after this upgrade and manually add the foreign key constraint for biblionumber in the items table.\n";
|
||||
} else {
|
||||
# now add FK
|
||||
$dbh->do( q|
|
||||
ALTER TABLE items
|
||||
ADD FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
|);
|
||||
print "Upgrade to $DBversion done (Bug 1xxxx - Add FK for biblionumber in items)\n";
|
||||
}
|
||||
#SetVersion($DBversion);
|
||||
#}
|
||||
|
|
@ -11583,6 +11583,27 @@ if ( CheckVersion($DBversion) ) {
|
|||
SetVersion($DBversion);
|
||||
}
|
||||
|
||||
$DBversion = "3.22.06.003";
|
||||
if ( CheckVersion($DBversion) ) {
|
||||
my ( $cnt ) = $dbh->selectrow_array( q|
|
||||
SELECT COUNT(*) FROM items it
|
||||
LEFT JOIN biblio bi ON bi.biblionumber=it.biblionumber
|
||||
LEFT JOIN biblioitems bii USING (biblioitemnumber)
|
||||
WHERE bi.biblionumber IS NULL
|
||||
|);
|
||||
if( $cnt ) {
|
||||
print "WARNING: You have corrupted data in your items table!! The table contains $cnt references to biblio records that do not exist.\nPlease correct your data IMMEDIATELY after this upgrade and manually add the foreign key constraint for biblionumber in the items table.\n";
|
||||
} else {
|
||||
# now add FK
|
||||
$dbh->do( q|
|
||||
ALTER TABLE items
|
||||
ADD FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
|);
|
||||
print "Upgrade to $DBversion done (Bug 16170 - Add FK for biblionumber in items)\n";
|
||||
}
|
||||
SetVersion($DBversion);
|
||||
}
|
||||
|
||||
|
||||
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
|
||||
# SEE bug 13068
|
||||
|
|
|
|||
Loading…
Reference in New Issue