mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Postgresql table creation fix for aliases, RemRatingProfile fix on Tenant name
This commit is contained in:
@@ -1128,7 +1128,7 @@ func (self *ApierV1) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder,
|
||||
|
||||
type AttrRemoveRatingProfile struct {
|
||||
Direction string
|
||||
Tennat string
|
||||
Tenant string
|
||||
Category string
|
||||
Subject string
|
||||
}
|
||||
@@ -1140,8 +1140,8 @@ func (arrp *AttrRemoveRatingProfile) GetId() (result string) {
|
||||
} else {
|
||||
return
|
||||
}
|
||||
if arrp.Tennat != "" && arrp.Tennat != utils.ANY {
|
||||
result += arrp.Tennat
|
||||
if arrp.Tenant != "" && arrp.Tenant != utils.ANY {
|
||||
result += arrp.Tenant
|
||||
result += utils.CONCATENATED_KEY_SEP
|
||||
} else {
|
||||
return
|
||||
@@ -1160,14 +1160,13 @@ func (arrp *AttrRemoveRatingProfile) GetId() (result string) {
|
||||
}
|
||||
|
||||
func (self *ApierV1) RemoveRatingProfile(attr AttrRemoveRatingProfile, reply *string) error {
|
||||
if attr.Subject != "" && attr.Category == "" {
|
||||
return fmt.Errorf("%s:%s", utils.ErrMandatoryIeMissing.Error(), "Category")
|
||||
if attr.Direction == "" {
|
||||
attr.Direction = utils.OUT
|
||||
}
|
||||
if attr.Category != "" && attr.Tennat == "" {
|
||||
return fmt.Errorf("%s:%s", utils.ErrMandatoryIeMissing.Error(), "Tenant")
|
||||
}
|
||||
if attr.Tennat != "" && attr.Direction == "" {
|
||||
return fmt.Errorf("%s:%s", utils.ErrMandatoryIeMissing.Error(), "Direction")
|
||||
if (attr.Subject != "" && utils.IsSliceMember([]string{attr.Direction, attr.Tenant, attr.Category}, "")) ||
|
||||
(attr.Category != "" && utils.IsSliceMember([]string{attr.Direction, attr.Tenant}, "")) ||
|
||||
attr.Tenant != "" && attr.Direction == "" {
|
||||
return utils.ErrMandatoryIeMissing
|
||||
}
|
||||
_, err := engine.Guardian.Guard(func() (interface{}, error) {
|
||||
err := self.RatingDb.RemoveRatingProfile(attr.GetId())
|
||||
|
||||
@@ -355,18 +355,18 @@ CREATE INDEX tpusers_idx ON tp_users (tpid,tenant,user_name);
|
||||
|
||||
DROP TABLE IF EXISTS tp_aliases;
|
||||
CREATE TABLE tp_aliases (
|
||||
`id` SERIAL PRIMARY KEY,
|
||||
`tpid` VARCHAR(64) NOT NULL,
|
||||
`direction` VARCHAR(8) NOT NULL,
|
||||
`tenant` VARCHAR(64) NOT NULL,
|
||||
`category` VARCHAR(32) NOT NULL,
|
||||
`account` VARCHAR(64) NOT NULL,
|
||||
`subject` VARCHAR(64) NOT NULL,
|
||||
`group` VARCHAR(64) NOT NULL,
|
||||
`destionation_id` VARCHAR(64) NOT NULL,
|
||||
`alias` VARCHAR(64) NOT NULL,
|
||||
`weight` NUMERIC(8,2) NOT NULL,
|
||||
`created_at` TIMESTAMP
|
||||
"id" SERIAL PRIMARY KEY,
|
||||
"tpid" VARCHAR(64) NOT NULL,
|
||||
"direction" VARCHAR(8) NOT NULL,
|
||||
"tenant" VARCHAR(64) NOT NULL,
|
||||
"category" VARCHAR(32) NOT NULL,
|
||||
"account" VARCHAR(64) NOT NULL,
|
||||
"subject" VARCHAR(64) NOT NULL,
|
||||
"group" VARCHAR(64) NOT NULL,
|
||||
"destionation_id" VARCHAR(64) NOT NULL,
|
||||
"alias" VARCHAR(64) NOT NULL,
|
||||
"weight" NUMERIC(8,2) NOT NULL,
|
||||
"created_at" TIMESTAMP
|
||||
);
|
||||
CREATE INDEX tpaliases_tpid_idx ON tp_aliases (tpid);
|
||||
CREATE INDEX tpaliases_idx ON tp_aliases (`tpid`,`direction`,`tenant,category`,`account`,`subject`,`group`);
|
||||
CREATE INDEX tpaliases_idx ON tp_aliases ("tpid","direction","tenant","category","account","subject","group");
|
||||
|
||||
Reference in New Issue
Block a user