From 1ec8d12a7b125d41ecb723c5d83f2afef95408e9 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Sun, 31 Jul 2016 09:40:25 +0200
Subject: 0.5.2 emails
---
install/upgrade.php | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
(limited to 'install/upgrade.php')
diff --git a/install/upgrade.php b/install/upgrade.php
index db0c913..c759df0 100644
--- a/install/upgrade.php
+++ b/install/upgrade.php
@@ -141,6 +141,27 @@ if (isset($_GET['upgrade'])) {
}
}
+ if (lower_version($_GET['upgrade'], '0.5.2')) {
+ try {
+ $_pdo->query("CREATE TABLE IF NOT EXISTS `".Constants::db_prefix."mail` (
+ `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+ `contactId` smallint(5) unsigned NOT NULL,
+ `offerId` smallint(5) unsigned DEFAULT NULL,
+ `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `subject` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `contactId` (`contactId`),
+ KEY `offerId` (`offerId`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
+
+ $_pdo->query("ALTER TABLE `".Constants::db_prefix."mail`
+ ADD CONSTRAINT `mail_ibfk_1` FOREIGN KEY (`contactId`) REFERENCES `".Constants::db_prefix."contact` (`id`) ON UPDATE CASCADE,
+ ADD CONSTRAINT `mail_ibfk_2` FOREIGN KEY (`offerId`) REFERENCES `".Constants::db_prefix."offer` (`id`) ON UPDATE CASCADE;");
+ } catch (PDOException $e) {
+ echo "Altering the database structure failed with a PDOException ({$e->getCode()}): {$e->getMessage()}
" . $e->getTraceAsString();
+ }
+ }
+
echo "
All done.";
}
?>
--
cgit v1.2.3