Quantcast

Reset db if currentVersion > target version.

Peter Eliasson [08-07-16 - 16:44]
Reset db if currentVersion > target version.
Filename
src/migrate.lua
diff --git a/src/migrate.lua b/src/migrate.lua
index 6ffdb72..dd59ad2 100644
--- a/src/migrate.lua
+++ b/src/migrate.lua
@@ -160,6 +160,11 @@ function migrate:DoMigration()
 	self:Debug(format("Attempting to migrate from dbVersion: %d to %d.",
 		currentVersion, targetVersion));

+	if currentVersion > targetVersion then
+		self:Debug(format("Could not migrate from dbVersion: %d!", currentVersion));
+		resetDb();
+	end
+
 	while currentVersion < targetVersion do
 		local migrateFunction = migrateTable[currentVersion];
 		if migrateFunction then