From d5b9da237ffdc072f200257acf92faa5a7af1969 Mon Sep 17 00:00:00 2001 From: edwardro22 Date: Thu, 8 Feb 2018 12:42:27 +0200 Subject: [PATCH] cgr-loader tarrifplan remove based on tpid, fixes #524 --- cmd/cgr-loader/cgr-loader.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/cgr-loader/cgr-loader.go b/cmd/cgr-loader/cgr-loader.go index 9fcf89e3c..485eeee25 100755 --- a/cmd/cgr-loader/cgr-loader.go +++ b/cmd/cgr-loader/cgr-loader.go @@ -67,6 +67,7 @@ var ( loadHistorySize = flag.Int("load_history_size", config.CgrConfig().LoadHistorySize, "Limit the number of records in the load history") timezone = flag.String("timezone", config.CgrConfig().DefaultTimezone, `Timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>`) disable_reverse = flag.Bool("disable_reverse_mappings", false, "Will disable reverse mappings rebuilding") + flush_stordb = flag.Bool("flush_stordb", false, "Remove tariff plan data for id from the database") remove = flag.Bool("remove", false, "Will remove any data from db that matches data files") ) @@ -118,10 +119,17 @@ func main() { } // Init necessary db connections, only if not already if !*dryRun { // make sure we do not need db connections on dry run, also not importing into any stordb + //tpid_remove + if *toStorDb { // Import files from a directory into storDb if *tpid == "" { log.Fatal("TPid required, please define it via *-tpid* command argument.") } + if *flush_stordb { + if err = storDb.RemTpData("", *tpid, map[string]string{}); err != nil { + log.Fatal(err) + } + } csvImporter := engine.TPCSVImporter{ TPid: *tpid, StorDb: storDb,