From 23758c034f81e1063ab0c033b6f5f57c28d62af3 Mon Sep 17 00:00:00 2001 From: Jon Bonilla Date: Fri, 31 Aug 2012 14:37:16 +0000 Subject: [PATCH] Drop duplicate rules for the same group --- db_scripts/diff/10180.up | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/db_scripts/diff/10180.up b/db_scripts/diff/10180.up index 3be5b93e..8d6fbe15 100644 --- a/db_scripts/diff/10180.up +++ b/db_scripts/diff/10180.up @@ -1,5 +1,10 @@ -use kamailio; +# Remove duplicated rules on the same group. Triggers should do the rest for lcr_rule. + +use provisioning; +ALTER IGNORE TABLE voip_peer_rules ADD UNIQUE KEY `idx1temp` (`group_id`, `callee_prefix`, `callee_pattern`, `caller_pattern`); +ALTER TABLE voip_peer_rules DROP KEY `idx1temp`; -#ALTER TABLE lcr_rule DROP KEY `lcr_id_prefix_from_uri_idx`; +# Now we can create the unique key without duplicates +use kamailio; ALTER TABLE lcr_rule ADD UNIQUE KEY `lcr_id_prefix_from_uri_idx` (`lcr_id`,`prefix`,`from_uri`, `request_uri`, `group_id`);