From b3745490456df8e1e914ac944fba14e95f0039fc Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Mon, 14 Apr 2014 21:27:06 +0200 Subject: [PATCH] MT#6693 Add voip_subscriber_profile_sets table. --- db_scripts/diff/15055.down | 2 ++ db_scripts/diff/15055.up | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/db_scripts/diff/15055.down b/db_scripts/diff/15055.down index c7fce07d..0309eae4 100644 --- a/db_scripts/diff/15055.down +++ b/db_scripts/diff/15055.down @@ -1,7 +1,9 @@ USE provisioning; ALTER TABLE voip_subscribers + DROP COLUMN profile_set_id, DROP COLUMN profile_id; DROP TABLE voip_subscriber_profile_attributes; DROP TABLE voip_subscriber_profiles; +DROP TABLE voip_subscriber_profile_sets; diff --git a/db_scripts/diff/15055.up b/db_scripts/diff/15055.up index c5b44e5e..6058959c 100644 --- a/db_scripts/diff/15055.up +++ b/db_scripts/diff/15055.up @@ -1,6 +1,6 @@ USE provisioning; -CREATE TABLE `voip_subscriber_profiles` ( +CREATE TABLE `voip_subscriber_profile_sets` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `reseller_id` int(11) unsigned NOT NULL, `name` varchar(255) NOT NULL, @@ -9,6 +9,17 @@ CREATE TABLE `voip_subscriber_profiles` ( UNIQUE KEY `vsp_resname_idx` (`reseller_id`,`name`) ) ENGINE=InnoDB; +CREATE TABLE `voip_subscriber_profiles` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `set_id` int(11) unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `description` varchar(255) NOT NULL, + `set_default` tinyint(1) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `set_name_idx` (`set_id`,`name`), + CONSTRAINT `voip_subscriber_profile_sets_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `voip_subscriber_profile_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + CREATE TABLE `voip_subscriber_profile_attributes` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `profile_id` int(11) unsigned NOT NULL, @@ -17,8 +28,10 @@ CREATE TABLE `voip_subscriber_profile_attributes` ( UNIQUE KEY `prof_attr_idx` (`profile_id`,`attribute_id`), KEY `attribute_id` (`attribute_id`), KEY `profile_idx` (`profile_id`), - CONSTRAINT `voip_subscriber_profile_attributes_ibfk_1` FOREIGN KEY (`attribute_id`) REFERENCES `voip_preferences` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `voip_subscriber_profile_attributes_ibfk_1` FOREIGN KEY (`attribute_id`) REFERENCES `voip_preferences` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `voip_subscriber_profile_attributes_ibfk_2` FOREIGN KEY (`profile_id`) REFERENCES `voip_subscriber_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB; ALTER TABLE voip_subscribers - ADD COLUMN profile_id INT(11) UNSIGNED DEFAULT NULL AFTER pbx_group_id; + ADD COLUMN profile_set_id INT(11) UNSIGNED DEFAULT NULL AFTER pbx_group_id, + ADD COLUMN profile_id INT(11) UNSIGNED DEFAULT NULL AFTER profile_set_id;