Quantcast

Changed data major versions to 1.0, added upgrade/downgrade functions

Kevin Lyles [12-03-09 - 00:43]
Changed data major versions to 1.0, added upgrade/downgrade functions
Filename
Upgrade.lua
WeightsWatcher.toc
config.lua
defaults.lua
diff --git a/Upgrade.lua b/Upgrade.lua
index 5b74305..8bec6fd 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -128,6 +128,31 @@ noop_down = [[
 	end
 ]]

+function noop_major_up(vars)
+	vars.dataMajorVersion = vars.dataMajorVersion + 1
+	vars.dataMinorVersion = 0
+
+	return vars
+end
+
+downgradeAccountToDevelopment = [[
+	return function(vars)
+		vars.dataMajorVersion = 0
+		vars.dataMinorVersion = 10
+
+		return vars
+	end
+]]
+
+downgradeCharToDevelopment = [[
+	return function(vars)
+		vars.dataMajorVersion = 0
+		vars.dataMinorVersion = 2
+
+		return vars
+	end
+]]
+
 function upgradeAccountToConfig(vars)
 	local table = vars.options.tooltip
 	local conversion = {
@@ -393,6 +418,7 @@ upgradeAccountFunctions = {
 		[7] = function(vars) return upgradeAccountHideModKeyHints(vars) end,
 		[8] = function(vars) return upgradeAccountForceGemColors(vars) end,
 		[9] = function(vars) return upgradeAccountToConfig(vars) end,
+		[10] = function(vars) return noop_major_up(vars) end,
 	},
 }

@@ -408,12 +434,16 @@ downgradeAccountFunctions = {
 		[9] = noop_down,
 		[10] = downgradeAccountFromConfig,
 	},
+	[1] = {
+		[0] = downgradeAccountToDevelopment,
+	},
 }

 upgradeCharFunctions = {
 	[0] = {
 		[0] = function(vars) return copyDefaultCharVars() end,
 		[1] = function(vars) return upgradeCharToOrderedLists(vars) end,
+		[2] = function(vars) return noop_major_up(vars) end,
 	},
 }

@@ -421,4 +451,7 @@ downgradeCharFunctions = {
 	[0] = {
 		[2] = downgradeCharFromOrderedLists,
 	},
+	[1] = {
+		[0] = downgradeCharToDevelopment,
+	},
 }
diff --git a/WeightsWatcher.toc b/WeightsWatcher.toc
index 75c8f95..c2b3e62 100644
--- a/WeightsWatcher.toc
+++ b/WeightsWatcher.toc
@@ -2,7 +2,7 @@
 ## Title: Weights Watcher
 ## Notes: Ranks gear according to customizable stat weights
 ## Author: The Flying Squirrels
-## Version: 0.1
+## Version: 1.0b1
 ## SavedVariables: ww_vars
 ## SavedVariablesPerCharacter: ww_charVars
 ## X-Category: Interface Enhancements
diff --git a/config.lua b/config.lua
index 23f7cb5..e8b338c 100644
--- a/config.lua
+++ b/config.lua
@@ -25,7 +25,7 @@ function commandHandler(msg)
 			ww_weights:Show()
 		end
 	elseif msg == "version" then
-		print("WeightsWatcher version: 1.0a1")
+		print("WeightsWatcher version: 1.0b1")
 		print("  Account data version: " .. ww_vars.dataMajorVersion .. "." .. ww_vars.dataMinorVersion)
 		print("  Character data version: " .. ww_charVars.dataMajorVersion .. "." .. ww_charVars.dataMinorVersion)
 	else
diff --git a/defaults.lua b/defaults.lua
index 7bf3fd6..3baef91 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -135,8 +135,8 @@ classNameOptions = {
 }

 defaultVars = {
-	dataMajorVersion = 0,
-	dataMinorVersion = 10,
+	dataMajorVersion = 1,
+	dataMinorVersion = 0,
 	weightsList = {
 		[1] = "DEATHKNIGHT",
 		[2] = "DRUID",
@@ -545,7 +545,7 @@ defaultVars = {
 }

 defaultCharVars = {
-	dataMajorVersion = 0,
-	dataMinorVersion = 2,
+	dataMajorVersion = 1,
+	dataMinorVersion = 0,
 	activeWeights = {},
 }