Skip to content

Commit

Permalink
Fix: The Postman Missions Quest - migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
htc16 committed Jun 29, 2024
1 parent f78fe47 commit c1e8beb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 21 additions & 1 deletion data-otservbr-global/migrations/46.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
logger.info("Updating database to version 46 (update Fix: The Postman Missions Quest - player_storage values)")

local storageKey = 51366
local oldValue = 8
local newValue = 9

local result = db.query("SELECT `player_id` FROM `player_storage` WHERE `key` = " .. storageKey .. " AND `value` = " .. oldValue)
if result:getID() ~= -1 then
repeat
local playerId = result:getDataInt("player_id")
if playerId then
db.query("UPDATE `player_storage` SET `value` = " .. newValue .. " WHERE `player_id` = " .. playerId .. " AND `key` = " .. storageKey)
logger.info("Updated player ID: " .. playerId)
end
until not result:next()
result:free()
else
logger.info("No player found with the specified value in player_storage.")
end

return true
end
3 changes: 3 additions & 0 deletions data-otservbr-global/migrations/47.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
end

0 comments on commit c1e8beb

Please sign in to comment.