flickerstreak@211: local _, addonTable = ... flickerstreak@211: local ReAction = addonTable.ReAction flickerstreak@211: flickerstreak@211: ReAction.PROFILEVERSION_LATEST = 1 flickerstreak@211: flickerstreak@213: ReAction.defaultProfile = { flickerstreak@213: profile = { flickerstreak@213: dbversion = nil, flickerstreak@213: bars = { }, flickerstreak@213: options = { flickerstreak@213: hideBlizzardBars = false, flickerstreak@213: hideBlizzardVehicleBar = false, flickerstreak@213: }, flickerstreak@213: }, flickerstreak@213: global = { flickerstreak@213: skipKeybindWarning = false, flickerstreak@213: } flickerstreak@213: } flickerstreak@213: flickerstreak@213: function ReAction:UpgradeProfile() flickerstreak@211: local db = self.db flickerstreak@211: flickerstreak@211: if not db.profile.dbversion then flickerstreak@211: -- upgrade from legacy db to v1 flickerstreak@211: flickerstreak@213: -- (1) remove unused defaultBars table (cleanup) flickerstreak@211: db.profile.defaultBars = nil flickerstreak@211: flickerstreak@211: -- (2) HideBlizzard is no longer a module flickerstreak@215: local hb = db:GetNamespace("HideBlizzard",true) or db:RegisterNamespace("HideBlizzard") flickerstreak@213: if hb then flickerstreak@213: db.profile.options.hideBlizzardBars = hb.profile.hide flickerstreak@213: db.profile.options.hideBlizzardVehicleBar = hb.profile.hideVehicle flickerstreak@213: hb:ResetProfile() flickerstreak@213: end flickerstreak@213: flickerstreak@213: -- (3) LBF is no longer a module flickerstreak@215: local bf = db:GetNamespace("ButtonFacade",true) or db:RegisterNamespace("ButtonFacade") flickerstreak@213: if bf then flickerstreak@213: for name, bar in pairs(db.profile.bars) do flickerstreak@213: bar.ButtonFacade = bf.profile[name] or bar.ButtonFacade flickerstreak@213: end flickerstreak@213: bf:ResetProfile() flickerstreak@211: end flickerstreak@211: flickerstreak@220: -- (4) Action is no longer a module, uses the bar config directly flickerstreak@220: local action = db:GetNamespace("Action",true) or db:RegisterNamespace("Action") flickerstreak@220: if action then flickerstreak@220: for name, ac in pairs(action.profile.bars) do flickerstreak@220: local c = db.profile.bars[name] flickerstreak@220: if c then flickerstreak@220: for key, value in pairs(ac) do flickerstreak@220: c[key] = value flickerstreak@220: end flickerstreak@220: end flickerstreak@220: end flickerstreak@220: action:ResetProfile() flickerstreak@220: end flickerstreak@220: flickerstreak@211: db.profile.dbversion = 1 flickerstreak@211: end flickerstreak@211: flickerstreak@211: db.profile.dbversion = self.PROFILEVERSION_LATEST flickerstreak@211: end