MT#6789 Add email template schema.

Add email templates for resellers.
Let contracts have email templates
Let subscribers have contacts.
Add password reset journal.
mr3.3
Andreas Granig 11 years ago
parent e16d3422d7
commit c86f8ed18e

@ -0,0 +1,11 @@
USE billing;
DROP TABLE email_templates;
DROP TABLE password_resets;
ALTER TABLE contracts
DROP COLUMN subscriber_email_template_id,
DROP COLUMN passreset_email_template_id;
ALTER TABLE voip_subscribers
DROP COLUMN contact_id;

@ -0,0 +1,31 @@
USE billing;
CREATE TABLE `email_templates` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`reseller_id` int(11) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`from_email` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`body` mediumtext NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `reseller_name_idx` (`reseller_id`,`name`),
CONSTRAINT `fk_email_reseller` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
CREATE TABLE `password_resets` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`subscriber_id` int(11) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
`timestamp` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `uuid_idx` (`uuid`),
KEY `fk_pwd_reset_sub` (`subscriber_id`),
CONSTRAINT `fk_pwd_reset_sub` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
ALTER TABLE contracts
ADD COLUMN subscriber_email_template_id INT(11) UNSIGNED DEFAULT NULL,
ADD COLUMN passreset_email_template_id INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE voip_subscribers
ADD COLUMN `contact_id` int(11) unsigned DEFAULT NULL;
Loading…
Cancel
Save