From dc5ecf9956932c00194d97d4326e38d2ba7f85f9 Mon Sep 17 00:00:00 2001 From: TeoV Date: Mon, 4 Jan 2021 10:30:13 +0200 Subject: [PATCH] Add in storage tp_account_profile schema fixes #2573 --- .../mysql/create_tariffplan_tables.sql | 25 +++++++++++++++++++ .../postgres/create_tariffplan_tables.sql | 23 +++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/data/storage/mysql/create_tariffplan_tables.sql b/data/storage/mysql/create_tariffplan_tables.sql index 7e190deda..82dbf4285 100644 --- a/data/storage/mysql/create_tariffplan_tables.sql +++ b/data/storage/mysql/create_tariffplan_tables.sql @@ -537,6 +537,31 @@ CREATE TABLE tp_action_profiles ( `id`,`filter_ids`,`action_id` ) ); + +DROP TABLE IF EXISTS tp_account_profiles; +CREATE TABLE tp_account_profiles ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `tpid` varchar(64) NOT NULL, + `tenant` varchar(64) NOT NULL, + `id` varchar(64) NOT NULL, + `filter_ids` varchar(64) NOT NULL, + `activation_interval` varchar(64) NOT NULL, + `weight` decimal(8,2) NOT NULL, + `balance_id` varchar(64) NOT NULL, + `balance_filter_ids` varchar(64) NOT NULL, + `balance_weight` decimal(8,2) NOT NULL, + `balance_blocker` BOOLEAN NOT NULL, + `balance_type` varchar(64) NOT NULL, + `balance_opts` varchar(64) NOT NULL, + `balance_value` decimal(8,2) NOT NULL, + `threshold_ids` varchar(64) NOT NULL, + `created_at` TIMESTAMP, + PRIMARY KEY (`pk`), + KEY `tpid` (`tpid`), + UNIQUE KEY `unique_tp_account_profiles` (`tpid`,`tenant`, + `id`,`filter_ids`,`balance_id` ) +); + -- -- Table structure for table `versions` -- diff --git a/data/storage/postgres/create_tariffplan_tables.sql b/data/storage/postgres/create_tariffplan_tables.sql index fce11351b..04fa5eb56 100644 --- a/data/storage/postgres/create_tariffplan_tables.sql +++ b/data/storage/postgres/create_tariffplan_tables.sql @@ -522,6 +522,29 @@ CREATE TABLE tp_action_profiles ( "filter_ids", "action_id"); +DROP TABLE IF EXISTS tp_account_profiles; +CREATE TABLE tp_account_profiles ( + "pk" SERIAL PRIMARY KEY, + "tpid" varchar(64) NOT NULL, + "tenant" varchar(64) NOT NULL, + "id" varchar(64) NOT NULL, + "filter_ids" varchar(64) NOT NULL, + "activation_interval" varchar(64) NOT NULL, + "weight" decimal(8,2) NOT NULL, + "balance_id" varchar(64) NOT NULL, + "balance_filter_ids" varchar(64) NOT NULL, + "balance_weight" decimal(8,2) NOT NULL, + "balance_blocker" BOOLEAN NOT NULL, + "balance_type" varchar(64) NOT NULL, + "balance_opts" varchar(64) NOT NULL, + "balance_value" decimal(8,2) NOT NULL, + "threshold_ids" varchar(64) NOT NULL, + "created_at" TIMESTAMP WITH TIME ZONE +); + CREATE INDEX tp_account_profiles_ids ON tp_account_profiles (tpid); + CREATE INDEX tp_account_profiles_unique ON tp_account_profiles ("tpid", "tenant", "id", + "filter_ids", "balance_id"); + -- -- Table structure for table `versions` --