You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
db-schema/db_scripts/diff/15005.up

39 lines
1.4 KiB

USE billing;
SET AUTOCOMMIT=0;
ALTER TABLE products CHANGE COLUMN class class ENUM('sippeering', 'pstnpeering', 'reseller', 'sipaccount', 'pbxaccount') NOT NULL;
INSERT INTO products VALUES
(NULL, NULL, 'sipaccount', 'SIP_ACCOUNT', 'Basic SIP Account', 1, NULL, NULL, NULL);
SELECT LAST_INSERT_ID() INTO @sip_id;
UPDATE billing_mappings SET product_id = @sip_id WHERE product_id IS NULL;
INSERT INTO products VALUES
(NULL, NULL, 'pbxaccount', 'PBX_ACCOUNT', 'Cloud PBX Account', 1, NULL, NULL, NULL);
USE provisioning;
ALTER TABLE voip_subscribers
ADD COLUMN is_pbx_group TINYINT(1) NOT NULL DEFAULT 0 AFTER webpassword;
ALTER TABLE voip_subscribers
CHANGE COLUMN autoconf_group_id pbx_group_id INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE voip_subscribers
DROP COLUMN autoconf_displayname;
CREATE TABLE `voip_pbx_groups` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`contract_id` int(11) unsigned NOT NULL,
`subscriber_id` int(11) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`extension` varchar(255) DEFAULT NULL,
`hunt_policy` enum('serial','parallel') NOT NULL DEFAULT 'serial',
`hunt_policy_timeout` int(4) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `contract_idx` (`contract_id`),
KEY `subscriber_idx` (`subscriber_id`),
CONSTRAINT `fk_v_sub_group` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;