Make Action Profiles storable in MySQL and Postgres

This commit is contained in:
arberkatellari
2025-11-04 10:36:03 +02:00
committed by Dan Christian Bogos
parent 89653a9c80
commit d78f34bdc5
18 changed files with 346 additions and 53 deletions

View File

@@ -21,7 +21,8 @@
},
},
"items": {
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"}
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
"*action_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
}
},

View File

@@ -23,7 +23,8 @@
}
},
"items": {
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"}
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
"*action_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
}
},

View File

@@ -0,0 +1,55 @@
{
"logger": {
"level": 7
},
"db": {
"db_conns": {
"*default": {
"db_type": "redis",
"db_port": 6379,
"db_name": "10"
},
"StorDB": { // The id of the DB connection
"db_type": "mysql", // db type: <internal|redis|mysql|mongo|postgres>
"db_host": "127.0.0.1", // the host to connect to
"db_port": 3306, // db port to reach the database
"db_name": "cgrates", // db database name to connect to
"db_user": "cgrates", // username to use when connecting to the database
"db_password": "CGRateS.org" // password to use when connecting to the database
},
},
"items": {
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"}
}
},
"actions": {
"enabled": true,
"thresholds_conns": ["*internal"],
"stats_conns": ["*internal"],
"accounts_conns": ["*internal"]
},
"accounts": {
"enabled": true
},
"stats": {
"enabled": true,
"store_interval": "-1",
"thresholds_conns": ["*internal"]
},
"thresholds": {
"enabled": true,
"store_interval": "-1",
"actions_conns": ["*internal"]
},
"admins": {
"enabled": true
}
}

View File

@@ -36,7 +36,7 @@
},
},
"items": {
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"}
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
}
},

View File

@@ -36,7 +36,7 @@
},
"items": {
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
"*accounts": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"}
"*accounts": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
}
},

View File

@@ -33,4 +33,15 @@ CREATE TABLE ip_allocations (
PRIMARY KEY (`pk`),
UNIQUE KEY unique_tenant_id (`tenant`, `id`)
);
CREATE UNIQUE INDEX ip_allocations_idx ON ip_allocations (`id`);
CREATE UNIQUE INDEX ip_allocations_idx ON ip_allocations (`id`);
DROP TABLE IF EXISTS action_profiles;
CREATE TABLE action_profiles (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`tenant` VARCHAR(40) NOT NULL,
`id` VARCHAR(64) NOT NULL,
`action_profile` JSON NOT NULL,
PRIMARY KEY (`pk`),
UNIQUE KEY unique_tenant_id (`tenant`, `id`)
);
CREATE UNIQUE INDEX action_profiles_idx ON action_profiles (`id`);

View File

@@ -32,3 +32,14 @@ CREATE TABLE ip_allocations (
UNIQUE (tenant, id)
);
CREATE UNIQUE INDEX ip_allocations_idx ON ip_allocations ("id");
DROP TABLE IF EXISTS action_profiles;
CREATE TABLE action_profiles (
pk SERIAL PRIMARY KEY,
tenant VARCHAR(40) NOT NULL,
id VARCHAR(64) NOT NULL,
action_profile JSONB NOT NULL,
UNIQUE (tenant, id)
);
CREATE UNIQUE INDEX action_profiles_idx ON action_profiles ("id");