diff options
author | Camil Staps | 2016-08-01 17:21:49 +0200 |
---|---|---|
committer | Camil Staps | 2016-08-01 17:21:49 +0200 |
commit | 38736c4b8fd1e9da5f3e6d0c6c088db90c4186d2 (patch) | |
tree | 560d63b7cc31227751c9f32bd7e560c835e8d1d7 /install/upgrade.php | |
parent | Better Braintree error message (diff) |
Fix payment table
Diffstat (limited to 'install/upgrade.php')
-rw-r--r-- | install/upgrade.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/install/upgrade.php b/install/upgrade.php index 0ebff57..8c97172 100644 --- a/install/upgrade.php +++ b/install/upgrade.php @@ -94,9 +94,13 @@ if (isset($_GET['upgrade'])) { `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `offerId` smallint(5) unsigned NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + UNIQUE KEY `offerId` (`offerId`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;"); + $_pdo->query("ALTER TABLE `".Constants::db_prefix."payment` + ADD CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `".Constants::db_prefix."offer` (`id`);"); + $offers = $_pdo->query("SELECT `id`,`payment_received` FROM `".Constants::db_prefix."offer` WHERE `payment_received` IS NOT NULL"); $offers = $offers->fetchAll(PDO::FETCH_ASSOC); foreach ($offers as $offer) { |