aboutsummaryrefslogtreecommitdiff
path: root/install/index.php
diff options
context:
space:
mode:
authorCamil Staps2016-08-01 17:21:49 +0200
committerCamil Staps2016-08-01 17:21:49 +0200
commit38736c4b8fd1e9da5f3e6d0c6c088db90c4186d2 (patch)
tree560d63b7cc31227751c9f32bd7e560c835e8d1d7 /install/index.php
parentBetter Braintree error message (diff)
Fix payment table
Diffstat (limited to 'install/index.php')
-rw-r--r--install/index.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/install/index.php b/install/index.php
index 1bb4bdd..990c6eb 100644
--- a/install/index.php
+++ b/install/index.php
@@ -102,13 +102,14 @@ if (isset($_GET['create_tables'])) {
KEY `invoice_fileId_2` (`invoice_fileId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1");
- $_pdo->query("CREATE TABLE IF NOT EXISTS `payment` (
+ $_pdo->query("CREATE TABLE IF NOT EXISTS `".Constants::db_prefix."payment` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`offerId` smallint(5) unsigned NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`braintree_id` varchar(36) DEFAULT NULL,
`braintree_status` varchar(63) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `offerId` (`offerId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$_pdo->query("CREATE TABLE IF NOT EXISTS `".Constants::db_prefix."user` (
@@ -135,9 +136,8 @@ if (isset($_GET['create_tables'])) {
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`)");
- $_pdo->query("CREATE UNIQUE INDEX `payment_uniq_1` ON `".Constants::db_prefix."payment` (`offerId`);");
- $_pdo->query("ALTER TABLE `payment`
- ADD CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `offer` (`id`);");
+ $_pdo->query("ALTER TABLE `".Constants::db_prefix."payment`
+ ADD CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `".Constants::db_prefix."offer` (`id`);");
echo "Succeeded creating the database tables.";