Adding TBLSMCosts model

This commit is contained in:
DanB
2015-12-27 11:38:59 +01:00
parent 704b0811f3
commit f58a07a029
3 changed files with 39 additions and 0 deletions

View File

@@ -35,3 +35,17 @@ CREATE TABLE cdrs (
PRIMARY KEY (id),
UNIQUE KEY cdrrun (cgrid, run_id)
);
DROP TABLE IF EXISTS sm_costs;
CREATE TABLE sm_costs (
id int(11) NOT NULL AUTO_INCREMENT,
cgrid char(40) NOT NULL,
run_id varchar(64) NOT NULL,
cost_source varchar(64) NOT NULL,
cost_details text,
created_at TIMESTAMP,
deleted_at TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY costid (cgrid,run_id),
KEY deleted_at_idx (deleted_at)
);

View File

@@ -37,3 +37,18 @@ CREATE TABLE cdrs (
;
DROP INDEX IF EXISTS deleted_at_cp_idx;
CREATE INDEX deleted_at_cp_idx ON cdrs_primary (deleted_at);
DROP TABLE IF EXISTS sm_costs;
CREATE TABLE sm_costs (
id SERIAL PRIMARY KEY,
cgrid CHAR(40) NOT NULL,
run_id VARCHAR(64) NOT NULL,
cost_source VARCHAR(64) NOT NULL,
cost_details jsonb,
created_at TIMESTAMP,
deleted_at TIMESTAMP,
UNIQUE (cgrid, run_id)
);
DROP INDEX IF EXISTS deleted_at_smcost_idx;
CREATE INDEX deleted_at_smcost_idx ON sm_costs (deleted_at);

View File

@@ -426,3 +426,13 @@ type TBLCDRs struct {
func (t TBLCDRs) TableName() string {
return utils.TBL_CDRS
}
type TBLSMCosts struct {
ID int64
Cgrid string
RunID string
CostSource string
CostDetails string
CreatedAt time.Time
DeletedAt time.Time
}