diff --git a/db_scripts/diff/15055.down b/db_scripts/diff/15055.down new file mode 100644 index 00000000..c7fce07d --- /dev/null +++ b/db_scripts/diff/15055.down @@ -0,0 +1,7 @@ +USE provisioning; + +ALTER TABLE voip_subscribers + DROP COLUMN profile_id; + +DROP TABLE voip_subscriber_profile_attributes; +DROP TABLE voip_subscriber_profiles; diff --git a/db_scripts/diff/15055.up b/db_scripts/diff/15055.up new file mode 100644 index 00000000..c5b44e5e --- /dev/null +++ b/db_scripts/diff/15055.up @@ -0,0 +1,24 @@ +USE provisioning; + +CREATE TABLE `voip_subscriber_profiles` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reseller_id` int(11) unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `description` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `vsp_resname_idx` (`reseller_id`,`name`) +) ENGINE=InnoDB; + +CREATE TABLE `voip_subscriber_profile_attributes` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `profile_id` int(11) unsigned NOT NULL, + `attribute_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + 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 +) ENGINE=InnoDB; + +ALTER TABLE voip_subscribers + ADD COLUMN profile_id INT(11) UNSIGNED DEFAULT NULL AFTER pbx_group_id;