From 500ce4952a8e7ce65c4bf48571a5ca9ee99434f7 Mon Sep 17 00:00:00 2001 From: DanB Date: Wed, 10 Apr 2019 19:23:00 +0200 Subject: [PATCH] Timing_tag part of the action_plan unique constrains --- data/storage/mysql/create_tariffplan_tables.sql | 2 +- data/storage/mysql/setup_cgr_db.sh | 2 +- data/storage/postgres/create_tariffplan_tables.sql | 2 +- data/storage/postgres/setup_cgr_db.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/storage/mysql/create_tariffplan_tables.sql b/data/storage/mysql/create_tariffplan_tables.sql index dd4eb7d04..1fb9f9229 100644 --- a/data/storage/mysql/create_tariffplan_tables.sql +++ b/data/storage/mysql/create_tariffplan_tables.sql @@ -183,7 +183,7 @@ CREATE TABLE `tp_action_plans` ( `created_at` TIMESTAMP, PRIMARY KEY (`id`), KEY `tpid` (`tpid`), - UNIQUE KEY `unique_action_schedule` (`tpid`,`tag`,`actions_tag`) + UNIQUE KEY `unique_action_schedule` (`tpid`,`tag`,`actions_tag`,`timing_tag`) ); -- diff --git a/data/storage/mysql/setup_cgr_db.sh b/data/storage/mysql/setup_cgr_db.sh index 7f01227f6..8561b7e9d 100755 --- a/data/storage/mysql/setup_cgr_db.sh +++ b/data/storage/mysql/setup_cgr_db.sh @@ -22,7 +22,7 @@ mysql -u $1 -p$2 -h $host -D cgrates < "$DIR"/create_tariffplan_tables.sql tpt=$? if [ $cu = 0 ] && [ $cdrt = 0 ] && [ $tpt = 0 ]; then - echo -e "\n\t+++ CGR-DB successfully set-up! +++\n" + echo "\n\t+++ CGR-DB successfully set-up! +++\n" exit 0 fi diff --git a/data/storage/postgres/create_tariffplan_tables.sql b/data/storage/postgres/create_tariffplan_tables.sql index 1d79d0637..1190576aa 100644 --- a/data/storage/postgres/create_tariffplan_tables.sql +++ b/data/storage/postgres/create_tariffplan_tables.sql @@ -176,7 +176,7 @@ CREATE TABLE tp_action_plans ( timing_tag VARCHAR(64) NOT NULL, weight NUMERIC(8,2) NOT NULL, created_at TIMESTAMP WITH TIME ZONE, - UNIQUE (tpid, tag, actions_tag) + UNIQUE (tpid, tag, actions_tag, timing_tag) ); CREATE INDEX tpactionplans_tpid_idx ON tp_action_plans (tpid); CREATE INDEX tpactionplans_idx ON tp_action_plans (tpid,tag); diff --git a/data/storage/postgres/setup_cgr_db.sh b/data/storage/postgres/setup_cgr_db.sh index 2ae4d8830..66d011763 100755 --- a/data/storage/postgres/setup_cgr_db.sh +++ b/data/storage/postgres/setup_cgr_db.sh @@ -23,7 +23,7 @@ psql -U $user -h $host -d cgrates -f "$DIR"/create_tariffplan_tables.sql tpt=$? if [ $cdrt = 0 ] && [ $tpt = 0 ]; then - echo -e "\n\t+++ CGR-DB successfully set-up! +++\n" + echo "\n\t+++ CGR-DB successfully set-up! +++\n" exit 0 fi