Quantcast

Added upgrade function to fix empty options table

Kevin Lyles [10-25-12 - 01:00]
Added upgrade function to fix empty options table
Filename
Upgrade.lua
defaults.lua
diff --git a/Upgrade.lua b/Upgrade.lua
index 144fa1a..5966f71 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -36,6 +36,15 @@ local function noop_major_up(vars)
 	return vars
 end

+local function upgradeAccountToReplaceEmptyOptions(vars)
+	if not vars.options then
+		vars.options = ww_deepTableCopy(ww_defaultVars.options)
+	end
+
+	vars.dataMinorVersion = 6
+	return vars
+end
+
 local function upgradeAccountToMonks(vars)
 	if vars.weightsList["MONK"] == nil then
 		vars.weightsList["MONK"] = ww_deepTableCopy(ww_defaultVars.weightsList["MONK"])
@@ -1246,6 +1255,7 @@ local upgradeAccountFunctions = {
 		[2] = upgradeAccountToPVPResilience,
 		[3] = upgradeAccountToMoPEnhancements,
 		[4] = upgradeAccountToMonks,
+		[5] = upgradeAccountToReplaceEmptyOptions,
 	},
 }

@@ -1296,6 +1306,7 @@ local downgradeAccountFunctions = {
 		[3] = downgradeAccountFromPVPResilience,
 		[4] = downgradeAccountFromMoPEnhancements,
 		[5] = noop_down,
+		[6] = noop_down,
 	},
 }

diff --git a/defaults.lua b/defaults.lua
index d1b95e7..cd314f4 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -259,7 +259,7 @@ ww_classNameOptions = {

 ww_defaultVars = {
 	dataMajorVersion = 2,
-	dataMinorVersion = 5,
+	dataMinorVersion = 6,
 	weightsList = {
 		"DEATHKNIGHT",
 		"DRUID",