Browse Source

update db schema & views

4.3
lazedo 7 years ago
committed by Luis Azedo
parent
commit
cebd0b11d6
2 changed files with 44 additions and 1 deletions
  1. +24
    -1
      kamailio/db_scripts/db_kazoo-specific
  2. +20
    -0
      kamailio/db_scripts/ww_keepalive_views.sql

+ 24
- 1
kamailio/db_scripts/db_kazoo-specific View File

@ -54,9 +54,10 @@ CREATE TABLE keepalive (
failed INTEGER DEFAULT 0,
CONSTRAINT keepalive_idx UNIQUE (contact),
CONSTRAINT keepalive_idx_2 UNIQUE (slot, selected, time_sent, contact)
CONSTRAINT keepalive_idx_3 UNIQUE (slot, failed, contact)
);
INSERT INTO version (table_name, table_version) values ('keepalive','1');
INSERT INTO version (table_name, table_version) values ('keepalive','2');
create table auth_cache as select * from htable;
INSERT INTO version (table_name, table_version) select 'auth_cache', table_version from version where table_name = 'htable';
@ -89,6 +90,28 @@ INSERT INTO version (table_name, table_version) select 'auth_cache', table_versi
create unique index if not exists idx_dispatcher_destination on dispatcher(destination);
CREATE VIEW w_keepalive_contact as
SELECT id, slot, failed, case when instr(contact,";") > 0
then substr(contact, 1, instr(contact,";")-1)
else contact
end as contact
from keepalive;
CREATE VIEW w_location_contact as
SELECT id, case when instr(contact,";") > 0
then substr(contact, 1, instr(contact,";")-1)
else contact
end as contact
from location;
CREATE VIEW w_watchers_contact as
select id, case when instr(contact,";") > 0
then substr(contact, 1, instr(contact,";")-1)
else contact
end as contact
from active_watchers;
EOF
}


+ 20
- 0
kamailio/db_scripts/ww_keepalive_views.sql View File

@ -0,0 +1,20 @@
CREATE VIEW w_keepalive_contact as
SELECT id, slot, failed, case when instr(contact,";") > 0
then substr(contact, 1, instr(contact,";")-1)
else contact
end as contact
from keepalive;
CREATE VIEW w_location_contact as
SELECT id, case when instr(contact,";") > 0
then substr(contact, 1, instr(contact,";")-1)
else contact
end as contact
from location;
CREATE VIEW w_watchers_contact as
select id, case when instr(contact,";") > 0
then substr(contact, 1, instr(contact,";")-1)
else contact
end as contact
from active_watchers;

Loading…
Cancel
Save