From fef13ad29c451cda49ba0755b3a544dd1ff32058 Mon Sep 17 00:00:00 2001 From: Jon Bonilla Date: Thu, 30 Aug 2012 21:07:33 +0000 Subject: [PATCH] Fix unsynced prov-kam databases for gws If there are unsynced gws in kamailio database because the db schema was corrupt this rev should align the existing group_id fields and remove the orphaned ones. Thx agranig --- db_scripts/diff/10890.up | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db_scripts/diff/10890.up diff --git a/db_scripts/diff/10890.up b/db_scripts/diff/10890.up new file mode 100644 index 00000000..35a9edf5 --- /dev/null +++ b/db_scripts/diff/10890.up @@ -0,0 +1,5 @@ +#Sync group_id between provisioning hosts and lcr hosts +UPDATE kamailio.lcr_gw lg, provisioning.voip_peer_hosts vph SET lg.group_id = vph.group_id WHERE vph.ip = lg.ip_addr AND vph.port = lg.port; + +#Remove orphaned ones +DELETE FROM kamailio.lcr_gw WHERE ip_addr NOT IN (select ip from provisioning.voip_peer_hosts);