Bug 23590: Add atomic update file

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-11-13 15:55:19 +01:00 committed by Martin Renvoize
parent def0cd93b2
commit dbdcae1ccb
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
if( !column_exists( 'suggestions', 'lastmodificationby' ) ) {
$dbh->do(q|
ALTER TABLE suggestions ADD COLUMN lastmodificationby INT(11) DEFAULT NULL AFTER rejecteddate
|);
$dbh->do(q|
ALTER TABLE suggestions ADD CONSTRAINT `suggestions_ibfk_lastmodificationby` FOREIGN KEY (`lastmodificationby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
|);
}
if( !column_exists( 'suggestions', 'lastmodificationdate' ) ) {
$dbh->do(q|
ALTER TABLE suggestions ADD COLUMN lastmodificationdate DATE DEFAULT NULL
|);
}
# Always end with this (adjust the bug info)
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 23590 - Add lastmodificationby and lastmodificationdate to the suggestions table)\n";
}