From 2de178e991be4848148bd592f2be677f74af692c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 13 Nov 2019 15:55:19 +0100 Subject: [PATCH] Bug 23590: Add atomic update file Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Katrin Fischer --- installer/data/mysql/atomicupdate/bug_23590.perl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_23590.perl diff --git a/installer/data/mysql/atomicupdate/bug_23590.perl b/installer/data/mysql/atomicupdate/bug_23590.perl new file mode 100644 index 0000000000..cb6d48d2e4 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23590.perl @@ -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"; +} -- 2.11.0