diff UpdateDB.lua @ 211:97949dbe987f

Demodularize HideBlizzard - added framework for updating profile database - removed unused profile.defaultBars[]
author Flick <flickerstreak@gmail.com>
date Thu, 18 Nov 2010 12:59:00 -0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UpdateDB.lua	Thu Nov 18 12:59:00 2010 -0800
@@ -0,0 +1,27 @@
+local _, addonTable = ...
+local ReAction = addonTable.ReAction
+
+ReAction.PROFILEVERSION_LATEST = 1
+
+function ReAction:UpdateDB()
+  local db = self.db
+
+  if not db.profile.dbversion then
+    -- upgrade from legacy db to v1
+
+    -- (1) defaultBars table removed (pure cleanup, never used)
+    db.profile.defaultBars = nil
+
+    -- (2) HideBlizzard is no longer a module
+    local hdb = db:RegisterNamespace("HideBlizzard")
+    if hdb then
+      db.profile.options.hideBlizzardBars = hdb.profile.hide
+      db.profile.options.hideBlizzardVehicleBar = hdb.profile.hideVehicle
+      hdb:ResetProfile()
+    end
+
+    db.profile.dbversion = 1
+  end
+
+  db.profile.dbversion = self.PROFILEVERSION_LATEST
+end