Updated storage scripts to include the ees and ers DB

This commit is contained in:
Trial97
2021-05-28 13:47:57 +03:00
committed by Dan Christian Bogos
parent 40d3f5f196
commit f7460a6aa6
5 changed files with 15 additions and 7 deletions

View File

@@ -394,7 +394,7 @@
"export_path": "mysql://cgrates:CGRateS.org@127.0.0.1:3306",
"attempts": 1,
"opts": {
"sqlDBName": "exportedDatabase", // if dbName is not present "cgrates" will be used as default
"sqlDBName": "cgrates2", // if dbName is not present "cgrates" will be used as default
"sqlTableName": "expTable", // tableName is mandatory in opts for sql exporter
"maxIdleConns": "disable",
"sqlMaxIdleConns": "10",
@@ -415,7 +415,7 @@
"export_path": "mysql://cgrates:CGRateS.org@127.0.0.1:3306",
"attempts": 1,
"opts": {
"sqlDBName": "exportedDatabase",
"sqlDBName": "cgrates2",
"sqlTableName": "expTable",
"maxIdleConns": "disable",
"sqlMaxIdleConns": "10",

View File

@@ -4,8 +4,6 @@
--
CREATE DATABASE cgrates2;
CREATE DATABASE exportedDatabase;
GRANT ALL on cgrates.* TO 'cgrates'@'127.0.0.1' IDENTIFIED BY 'CGRateS.org';
GRANT ALL on cgrates2.* TO 'cgrates'@'127.0.0.1' IDENTIFIED BY 'CGRateS.org';
GRANT ALL on exportedDatabase.* TO 'cgrates'@'127.0.0.1' IDENTIFIED BY 'CGRateS.org';

View File

@@ -7,3 +7,9 @@ DROP DATABASE IF EXISTS cgrates;
CREATE DATABASE cgrates;
GRANT ALL on cgrates.* TO 'cgrates'@'localhost' IDENTIFIED BY 'CGRateS.org';
-- extra DB for ees and ers
DROP DATABASE IF EXISTS cgrates2;
CREATE DATABASE cgrates2;
GRANT ALL on cgrates2.* TO 'cgrates'@'localhost' IDENTIFIED BY 'CGRateS.org';

View File

@@ -7,3 +7,7 @@ sudo -u postgres dropdb -e cgrates
sudo -u postgres dropuser -e cgrates
sudo -u postgres psql -c "CREATE USER cgrates password 'CGRateS.org';"
sudo -u postgres createdb -e -O cgrates cgrates
# extra DB for ees and ers
sudo -u postgres dropdb -e cgrates2
sudo -u postgres createdb -e -O cgrates cgrates2

View File

@@ -76,7 +76,7 @@ type testModelSql struct {
Cost float64
}
func (_ *testModelSql) TableName() string {
func (*testModelSql) TableName() string {
return "expTable"
}
@@ -89,11 +89,11 @@ func testSqlEeCreateTable(t *testing.T) {
}); err != nil {
return
}
if err = db2.Exec(`CREATE DATABASE IF NOT EXISTS exportedDatabase;`).Error; err != nil {
if err = db2.Exec(`CREATE DATABASE IF NOT EXISTS cgrates2;`).Error; err != nil {
t.Fatal(err)
}
if db2, err = gorm.Open(mysql.Open(fmt.Sprintf(dbConnString, "exportedDatabase")), &gorm.Config{
if db2, err = gorm.Open(mysql.Open(fmt.Sprintf(dbConnString, "cgrates2")), &gorm.Config{
AllowGlobalUpdate: true,
Logger: logger.Default.LogMode(logger.Silent),
}); err != nil {