mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 08:08:45 +05:00
Fixed the detection of new schema in versions,fixes #750
This commit is contained in:
committed by
Dan Christian Bogos
parent
7143c886bf
commit
7e3821bc94
@@ -60,6 +60,11 @@ func (self *SQLStorage) Flush(scriptsPath string) (err error) {
|
||||
if _, err := self.Db.Query(fmt.Sprintf("SELECT 1 FROM %s", utils.TBLCDRs)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = SetDBVersions(self); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -97,6 +102,19 @@ func (self *SQLStorage) CreateTablesFromScript(scriptPath string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SQLStorage) IsDBEmpty() (resp bool, err error) {
|
||||
tbls := []string{utils.TBLTPTimings, utils.TBLTPDestinations, utils.TBLTPRates, utils.TBLTPDestinationRates, utils.TBLTPRatingPlans, utils.TBLTPRateProfiles,
|
||||
utils.TBLTPSharedGroups, utils.TBLTPCdrStats, utils.TBLTPLcrs, utils.TBLTPActions, utils.TBLTPActionPlans, utils.TBLTPActionTriggers, utils.TBLTPAccountActions,
|
||||
utils.TBLTPDerivedChargers, utils.TBLTPAliases, utils.TBLTPUsers, utils.TBLTPResources, utils.TBLTPStats}
|
||||
for _, tbl := range tbls {
|
||||
resp = self.db.HasTable(tbl)
|
||||
if resp != false {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// Return a list with all TPids defined in the system, even if incomplete, isolated in some table.
|
||||
func (self *SQLStorage) GetTpIds() ([]string, error) {
|
||||
rows, err := self.Db.Query(
|
||||
|
||||
Reference in New Issue
Block a user