aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrations/referrals.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations/referrals.sql')
-rw-r--r--db/migrations/referrals.sql18
1 files changed, 11 insertions, 7 deletions
diff --git a/db/migrations/referrals.sql b/db/migrations/referrals.sql
index b755000a..b59ffdf9 100644
--- a/db/migrations/referrals.sql
+++ b/db/migrations/referrals.sql
@@ -1,5 +1,5 @@
-- Note: Adding FK contraints may cause issues, so I have commented them out for now, but these need to be established
-
+DROP TABLE IF EXISTS `referrals`;
CREATE TABLE `referrals` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`token` varchar(255) DEFAULT NULL UNIQUE,
@@ -7,15 +7,16 @@ CREATE TABLE `referrals` (
`status` enum('pending','active','expired','cancelled') DEFAULT NULL,
`sponsor_id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
- `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
- `updated_at` datetime DEFAULT CURRENT_TIMESTAMP,
+ `created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
+ `updated_at` timestamp,
PRIMARY KEY (`id`),
KEY `sponsor_id` (`sponsor_id`),
KEY `user_id` (`user_id`)
-- FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
-- FOREIGN KEY (`sponsor_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS `waiting_list`;
CREATE TABLE `waiting_list` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`email` varchar(255) DEFAULT NULL UNIQUE,
@@ -23,8 +24,11 @@ CREATE TABLE `waiting_list` (
`user_id` int(11) DEFAULT NULL,
`status` enum('pending','contacted','registered','cancelled') DEFAULT 'pending',
`notes` text DEFAULT NULL,
- `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
- `updated_at` datetime DEFAULT CURRENT_TIMESTAMP,
+ `created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
+ `updated_at` timestamp,
PRIMARY KEY (`id`)
-- CONSTRAINT `user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 \ No newline at end of file
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+
+ALTER TABLE users ADD `email` varchar(255) DEFAULT NULL;
+ALTER TABLE users ADD `sms` varchar(255) DEFAULT NULL;