Add FilterProfile + test for it

This commit is contained in:
TeoV
2017-10-02 16:12:12 +03:00
parent d9984e68c3
commit a93522d8a1
37 changed files with 625 additions and 22 deletions

View File

@@ -471,6 +471,25 @@ CREATE TABLE tp_thresholds (
UNIQUE KEY `unique_tp_thresholds` (`tpid`,`tenant`, `id`, `filter_type`, `filter_field_name`)
);
--
-- Table structure for table `tp_filter`
--
DROP TABLE IF EXISTS tp_filters;
CREATE TABLE tp_filters (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`tpid` varchar(64) NOT NULL,
`tenant` varchar(64) NOT NULL,
`id` varchar(64) NOT NULL,
`filter_type` varchar(16) NOT NULL,
`filter_field_name` varchar(64) NOT NULL,
`filter_field_values` varchar(256) NOT NULL,
`created_at` TIMESTAMP,
PRIMARY KEY (`pk`),
KEY `tpid` (`tpid`),
UNIQUE KEY `unique_tp_filters` (`tpid`,`tenant`, `id`, `filter_type`, `filter_field_name`)
);
--
-- Table structure for table `versions`
--

View File

@@ -465,6 +465,25 @@ CREATE TABLE tp_thresholds (
CREATE INDEX tp_thresholds_idx ON tp_thresholds (tpid);
CREATE INDEX tp_thresholds_unique ON tp_thresholds ("tpid","tenant", "id", "filter_type", "filter_field_name");
--
-- Table structure for table `tp_filter`
--
DROP TABLE IF EXISTS tp_filters;
CREATE TABLE tp_filters (
"pk" SERIAL PRIMARY KEY,
"tpid" varchar(64) NOT NULL,
"tenant" varchar(64) NOT NULL,
"id" varchar(64) NOT NULL,
"filter_type" varchar(16) NOT NULL,
"filter_field_name" varchar(64) NOT NULL,
"filter_field_values" varchar(256) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE
);
CREATE INDEX tp_filters_idx ON tp_filters (tpid);
CREATE INDEX tp_filters_unique ON tp_filters ("tpid","tenant", "id", "filter_type", "filter_field_name");
--
-- Table structure for table `versions`

View File

@@ -0,0 +1,7 @@
#Tenant[0],ID[1],FilterType[2],FilterFieldName[3],FilterFieldValues[4]
cgrates.org,FLTR_1,*string,Account,1001;1002
cgrates.org,FLTR_1,*string_prefix,Destination,10;20
cgrates.org,FLTR_1,*rsr_fields,,Subject(~^1.*1$);Destination(1002)
cgrates.org,FLTR_ACNT_dan,*string,Account,dan
cgrates.org,FLTR_DST_DE,*destinations,Destination,DST_DE
cgrates.org,FLTR_DST_NL,*destinations,Destination,DST_NL
1 #Tenant[0] ID[1] FilterType[2] FilterFieldName[3] FilterFieldValues[4]
2 cgrates.org FLTR_1 *string Account 1001;1002
3 cgrates.org FLTR_1 *string_prefix Destination 10;20
4 cgrates.org FLTR_1 *rsr_fields Subject(~^1.*1$);Destination(1002)
5 cgrates.org FLTR_ACNT_dan *string Account dan
6 cgrates.org FLTR_DST_DE *destinations Destination DST_DE
7 cgrates.org FLTR_DST_NL *destinations Destination DST_NL

View File

@@ -0,0 +1,7 @@
#Tenant[0],ID[1],FilterType[2],FilterFieldName[3],FilterFieldValues[4]
cgrates.org,FLTR_1,*string,Account,1001;1002
cgrates.org,FLTR_1,*string_prefix,Destination,10;20
cgrates.org,FLTR_1,*rsr_fields,,Subject(~^1.*1$);Destination(1002)
cgrates.org,FLTR_ACNT_dan,*string,Account,dan
cgrates.org,FLTR_DST_DE,*destinations,Destination,DST_DE
cgrates.org,FLTR_DST_NL,*destinations,Destination,DST_NL
1 #Tenant[0] ID[1] FilterType[2] FilterFieldName[3] FilterFieldValues[4]
2 cgrates.org FLTR_1 *string Account 1001;1002
3 cgrates.org FLTR_1 *string_prefix Destination 10;20
4 cgrates.org FLTR_1 *rsr_fields Subject(~^1.*1$);Destination(1002)
5 cgrates.org FLTR_ACNT_dan *string Account dan
6 cgrates.org FLTR_DST_DE *destinations Destination DST_DE
7 cgrates.org FLTR_DST_NL *destinations Destination DST_NL