diff --git a/migrator/migrator_datadb.go b/migrator/migrator_datadb.go
new file mode 100644
index 000000000..3b38840e3
--- /dev/null
+++ b/migrator/migrator_datadb.go
@@ -0,0 +1,45 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package migrator
+
+import (
+ "github.com/cgrates/cgrates/engine"
+)
+
+type MigratorDataDB interface {
+ getv1Account() (v1Acnt *v1Account, err error)
+ setV1Account(x *v1Account) (err error)
+ getV1ActionPlans() (v1aps *v1ActionPlans, err error)
+ setV1ActionPlans(x *v1ActionPlans) (err error)
+ getV1Actions() (v1acs *v1Actions, err error)
+ setV1Actions(x *v1Actions) (err error)
+ getV1ActionTriggers() (v1acts *v1ActionTriggers, err error)
+ setV1ActionTriggers(x *v1ActionTriggers) (err error)
+ getV1SharedGroup() (v1acts *v1SharedGroup, err error)
+ setV1SharedGroup(x *v1SharedGroup) (err error)
+ getV1Stats() (v1st *v1Stat, err error)
+ setV1Stats(x *v1Stat) (err error)
+ getV2ActionTrigger() (v2at *v2ActionTrigger, err error)
+ setV2ActionTrigger(x *v2ActionTrigger) (err error)
+ getv2Account() (v2Acnt *v2Account, err error)
+ setV2Account(x *v2Account) (err error)
+ getV1AttributeProfile() (v1attrPrf *v1AttributeProfile, err error)
+ setV1AttributeProfile(x *v1AttributeProfile) (err error)
+ DataManager() *engine.DataManager
+}
diff --git a/migrator/migrator_stordb.go b/migrator/migrator_stordb.go
new file mode 100755
index 000000000..508632220
--- /dev/null
+++ b/migrator/migrator_stordb.go
@@ -0,0 +1,34 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package migrator
+
+import (
+ "github.com/cgrates/cgrates/engine"
+)
+
+type MigratorStorDB interface {
+ getV1CDR() (v1Cdr *v1Cdrs, err error)
+ setV1CDR(v1Cdr *v1Cdrs) (err error)
+ createV1SMCosts() (err error)
+ renameV1SMCosts() (err error)
+ getV2SMCost() (v2Cost *v2SessionsCost, err error)
+ setV2SMCost(v2Cost *v2SessionsCost) (err error)
+ remV2SMCost(v2Cost *v2SessionsCost) (err error)
+ StorDB() engine.StorDB
+}
diff --git a/migrator/migrator_utils.go b/migrator/migrator_utils.go
new file mode 100644
index 000000000..330eb67d3
--- /dev/null
+++ b/migrator/migrator_utils.go
@@ -0,0 +1,97 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package migrator
+
+import (
+ "errors"
+ "fmt"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func NewMigratorDataDB(db_type, host, port, name, user, pass, marshaler string,
+ cacheCfg config.CacheConfig, loadHistorySize int) (db MigratorDataDB, err error) {
+ dm, err := engine.ConfigureDataStorage(db_type,
+ host, port, name, user, pass, marshaler,
+ cacheCfg, loadHistorySize)
+ var d MigratorDataDB
+ if err != nil {
+ return nil, err
+ }
+ switch db_type {
+ case utils.REDIS:
+ d = newRedisMigrator(dm)
+ case utils.MONGO:
+ d = newMongoMigrator(dm)
+ db = d.(MigratorDataDB)
+ default:
+ err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are '%s' or '%s'",
+ db_type, utils.REDIS, utils.MONGO))
+ }
+ return d, nil
+}
+
+func NewMigratorStorDB(db_type, host, port, name, user, pass string,
+ maxConn, maxIdleConn, connMaxLifetime int, cdrsIndexes []string) (db MigratorStorDB, err error) {
+ var d MigratorStorDB
+ storDb, err := engine.ConfigureStorDB(db_type, host, port, name, user, pass,
+ maxConn, maxIdleConn, connMaxLifetime, cdrsIndexes)
+ if err != nil {
+ return nil, err
+ }
+ switch db_type {
+ case utils.MONGO:
+ d = newMongoStorDBMigrator(storDb)
+ db = d.(MigratorStorDB)
+ case utils.MYSQL:
+ d = newMigratorSQL(storDb)
+ db = d.(MigratorStorDB)
+ case utils.POSTGRES:
+ d = newMigratorSQL(storDb)
+ db = d.(MigratorStorDB)
+ default:
+ err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are '%s' or '%s'",
+ db_type, utils.MONGO, utils.MYSQL))
+ }
+ return d, nil
+}
+
+/*
+
+func ConfigureV1StorDB(db_type, host, port, name, user, pass string) (db MigratorStorDB, err error) {
+ var d MigratorStorDB
+ switch db_type {
+ case utils.MONGO:
+ d, err = newv1MongoStorage(host, port, name, user, pass, utils.StorDB, nil)
+ db = d.(MigratorStorDB)
+ case utils.MYSQL:
+ d, err = newSqlStorage(host, port, name, user, pass)
+ db = d.(MigratorStorDB)
+ default:
+ err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are '%s'",
+ db_type, utils.MONGO))
+ }
+ if err != nil {
+ return nil, err
+ }
+ return d, nil
+}
+*/