aboutsummaryrefslogtreecommitdiff
path: root/install/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'install/index.php')
-rw-r--r--install/index.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/install/index.php b/install/index.php
index 519e3c5..19cd5a4 100644
--- a/install/index.php
+++ b/install/index.php
@@ -75,6 +75,17 @@ if (isset($_GET['create_tables'])) {
UNIQUE KEY `filename` (`filename`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1");
+ $_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("CREATE TABLE IF NOT EXISTS `".Constants::db_prefix."offer` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`contactId` smallint(5) unsigned NOT NULL,
@@ -110,13 +121,17 @@ if (isset($_GET['create_tables'])) {
$_pdo->query("ALTER TABLE `".Constants::db_prefix."assignment`
ADD CONSTRAINT `assignment_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `".Constants::db_prefix."offer` (`id`)");
- $_pdo->query("ALTER LE `".Constants::db_prefix."contact`
+ $_pdo->query("ALTER TABLE `".Constants::db_prefix."contact`
ADD CONSTRAINT `contact_ibfk_1` FOREIGN KEY (`clientId`) REFERENCES `".Constants::db_prefix."client` (`id`)");
- $_pdo->query("ALTER LE `".Constants::db_prefix."discount`
+ $_pdo->query("ALTER TABLE `".Constants::db_prefix."discount`
ADD CONSTRAINT `discount_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `".Constants::db_prefix."offer` (`id`);");
- $_pdo->query("ALTER LE `".Constants::db_prefix."offer`
+ $_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;");
+
+ $_pdo->query("ALTER TABLE `".Constants::db_prefix."offer`
ADD CONSTRAINT `offer_ibfk_1` FOREIGN KEY (`invoice_fileId`) REFERENCES `".Constants::db_prefix."file` (`id`),
ADD CONSTRAINT `offer_ibfk_2` FOREIGN KEY (`contactId`) REFERENCES `".Constants::db_prefix."contact` (`id`)");