mirror of https://github.com/sipwise/db-schema.git
Remove any unused/legacy product definitions. Add sipaccount and pbxaccount products. Update billing mappings to use sipaccount product if none is set.vseva/pbx_groups
parent
2abd35182c
commit
414909abbc
@ -0,0 +1,13 @@
|
||||
USE billing;
|
||||
|
||||
SET AUTOCOMMIT=0;
|
||||
|
||||
SELECT id INTO @sip_id FROM billing_mappings WHERE class = 'sipaccount';
|
||||
UPDATE billing_mappings SET product_id = NULL WHERE product_id = @sip_id;
|
||||
|
||||
SELECT id INTO @pbx_id FROM billing_mappings WHERE class = 'pbxaccount';
|
||||
UPDATE billing_mappings SET product_id = NULL WHERE product_id = @pbx_id;
|
||||
|
||||
DELETE FROM products WHERE class IN ('sipaccount', 'pbxaccount');
|
||||
|
||||
COMMIT;
|
||||
@ -0,0 +1,15 @@
|
||||
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);
|
||||
|
||||
COMMIT;
|
||||
Loading…
Reference in new issue