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;