TT#43502 Add up script to fix typo introduced in 15400_not_replicated.up

A typo in 15400_not_replicated.up script cause the initial select
to return a NULL id, introducing some wrong lines in voip_preferences_enum
table.
The new up script delete the previously introduced wrong lines and
insert the correct ones.

Change-Id: I4e321978e932f866eeaec2b57cdc3deb3a3a0f35
changes/12/23112/3
Marco Capetta 7 years ago
parent 700d098232
commit 5a523c2f5a

@ -0,0 +1,18 @@
USE provisioning;
SET autocommit=0;
SET sql_log_bin=0;
SELECT id INTO @pref_id FROM voip_preferences WHERE attribute='force_inbound_calls_to_peer';
DELETE FROM voip_preferences_enum WHERE preference_id=@pref_id;
update voip_preferences set data_type = 'boolean', type = 1 where id = @pref_id;
update kamailio.usr_preferences set type = 1 where attribute='force_inbound_calls_to_peer';
update kamailio.dom_preferences set type = 1 where attribute='force_inbound_calls_to_peer';
delete from voip_usr_preferences where value <> 'force' and attribute_id = @pref_id;
update voip_usr_preferences set value = 1 where value = 'force' and attribute_id = @pref_id;
delete from voip_dom_preferences where value <> 'force' and attribute_id = @pref_id;
update voip_dom_preferences set value = 1 where value = 'force' and attribute_id = @pref_id;
commit;

@ -0,0 +1,26 @@
USE provisioning;
SET autocommit=0;
SET sql_log_bin=0;
DELETE FROM voip_preferences_enum WHERE preference_id is NULL;
SELECT id FROM voip_preferences WHERE attribute='force_inbound_calls_to_peer' INTO @vp_attr_id;
INSERT INTO voip_preferences_enum
(preference_id, label, value, usr_pref, dom_pref, prof_pref, peer_pref, contract_pref, contract_location_pref, default_val)
VALUES
(@vp_attr_id, 'use domain default', NULL, 1, 0, 1, 0, 0, 0, 1),
(@vp_attr_id, 'Never', 'never', 0, 1, 0, 0, 0, 0, 1),
(@vp_attr_id, 'Never', 'never', 1, 0, 1, 0, 0, 0, 0),
(@vp_attr_id, 'Always', 'force', 1, 1, 1, 0, 0, 0, 0),
(@vp_attr_id, 'If callee is offline', 'force_offline', 1, 1, 1, 0, 0, 0, 0),
(@vp_attr_id, 'If callee is offline and number is primary', 'force_offline_primary', 1, 1, 1, 0, 0, 0, 0),
(@vp_attr_id, 'If callee is offline and number is alias', 'force_offline_alias', 1, 1, 1, 0, 0, 0, 0);
update voip_preferences set data_type = 'enum', type = 0 where id = @vp_attr_id;
update voip_usr_preferences set value = 'force' where value = 1 and attribute_id = @vp_attr_id;
update voip_dom_preferences set value = 'force' where value = 1 and attribute_id = @vp_attr_id;
update kamailio.usr_preferences set type=0 where attribute='force_inbound_calls_to_peer';
update kamailio.dom_preferences set type=0 where attribute='force_inbound_calls_to_peer';
commit;
Loading…
Cancel
Save