Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
Fixed Bug with no Wrong updating DB version
Browse files Browse the repository at this point in the history
  • Loading branch information
captain1242 committed Mar 15, 2017
1 parent 9f0a660 commit e30f0f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[
"*.psd",
"*.vcproj",
"*.svn*"
"*.svn*",
"LICENSE",
"readme.md"
]
}
14 changes: 7 additions & 7 deletions lua/msync/mysql_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ if(file.Exists( "bin/gmsv_mysqloo_linux.dll", "LUA" ) or file.Exists( "bin/gmsv_
MSync_Version_Table.onError = function(Q,E) print("Q1") print(E) end
MSync_Version_Table:start()

MSync.Settings.DBVersion = MSync.DBVersion
MSync.Settings.RDBVersion = MSync.Settings.RDBVersion or 0
MSync.Settings.BDBVersion = MSync.Settings.BDBVersion or 0
end
Expand Down Expand Up @@ -92,6 +93,7 @@ if(file.Exists( "bin/gmsv_mysqloo_linux.dll", "LUA" ) or file.Exists( "bin/gmsv_
]])
transaction:addQuery(MRSyncUpdateDB)
print("[MRSync] Going to update DB structure to v1.1")
MSync.Settings.RDBVersion = MSync.RDBVersion
end
end

Expand Down Expand Up @@ -135,6 +137,7 @@ if(file.Exists( "bin/gmsv_mysqloo_linux.dll", "LUA" ) or file.Exists( "bin/gmsv_
]])
transaction:addQuery(updateQuery)
print("[MBSync] Going to update DB structure to v1.1")

end

if (MSync.Settings.BDBVersion < 1.2) then
Expand Down Expand Up @@ -162,8 +165,8 @@ if(file.Exists( "bin/gmsv_mysqloo_linux.dll", "LUA" ) or file.Exists( "bin/gmsv_
]])
transaction:addQuery(updateQuery)
print("[MBSync] Going to update DB structure to v1.3")
MSync.Settings.BDBVersion = MSync.BDBVersion
end

end
--[[if(table.HasValue(MSync.Settings.EnabledModules, "MPSync")) then
//Ranks
Expand All @@ -177,19 +180,16 @@ if(file.Exists( "bin/gmsv_mysqloo_linux.dll", "LUA" ) or file.Exists( "bin/gmsv_
if transaction:getQueries() ~= nil then
transaction.onError = function (tr, err) print("[MSync] Database creation/update failed: " .. err) end
transaction.onSuccess = function ()
MSync.Settings.DBVersion = MSync.DBVersion
MSync.Settings.RDBVersion = MSync.RDBVersion
MSync.Settings.BDBVersion = MSync.BDBVersion
MSync.SaveSettings()
print("[MSync] Database upgrade successful, current DB schema version " .. MSync.DBVersion)
end
transaction:start()
end

local MSync_Version_Table = server:query([[
INSERT into `msync_db_version` (`version`,`version_index`) VALUES (']]..MSync.DBVersion..[[','DBVersion') ON DUPLICATE KEY UPDATE version=VALUES(version);
INSERT into `msync_db_version` (`version`,`version_index`) VALUES (']]..MSync.RDBVersion..[[','RDBVersion') ON DUPLICATE KEY UPDATE version=VALUES(version);
INSERT into `msync_db_version` (`version`,`version_index`) VALUES (']]..MSync.BDBVersion..[[','BDBVersion') ON DUPLICATE KEY UPDATE version=VALUES(version)
INSERT into `msync_db_version` (`version`,`version_index`) VALUES (']]..MSync.Settings.DBVersion..[[','DBVersion') ON DUPLICATE KEY UPDATE version=VALUES(version);
INSERT into `msync_db_version` (`version`,`version_index`) VALUES (']]..MSync.Settings.RDBVersion..[[','RDBVersion') ON DUPLICATE KEY UPDATE version=VALUES(version);
INSERT into `msync_db_version` (`version`,`version_index`) VALUES (']]..MSync.Settings.BDBVersion..[[','BDBVersion') ON DUPLICATE KEY UPDATE version=VALUES(version)
]])
MSync_Version_Table.onError = function(Q,E) print("Q1") print(E) end
MSync_Version_Table:start()
Expand Down

0 comments on commit e30f0f6

Please sign in to comment.