mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 08:21:44 -04:00
Mark repair has been done by incremeting version to 3.1
This commit is contained in:
parent
b04762204e
commit
2f59e9f0f5
1 changed files with 9 additions and 6 deletions
15
migrate.lua
15
migrate.lua
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
local STORAGE_VERSION_KEY = "@@version"
|
local STORAGE_VERSION_KEY = "@@version"
|
||||||
|
local CURRENT_VERSION = 3.1
|
||||||
|
|
||||||
local function migrate_v1_to_v3()
|
local function migrate_v1_to_v3()
|
||||||
local file = io.open(minetest.get_worldpath().."/mail.db", "r")
|
local file = io.open(minetest.get_worldpath().."/mail.db", "r")
|
||||||
|
@ -134,11 +134,11 @@ end
|
||||||
|
|
||||||
function mail.migrate()
|
function mail.migrate()
|
||||||
-- check for v2 storage first, v1-migration might have set the v3-flag already
|
-- check for v2 storage first, v1-migration might have set the v3-flag already
|
||||||
local version = mail.storage:get_int(STORAGE_VERSION_KEY)
|
local version = mail.storage:get_float(STORAGE_VERSION_KEY)
|
||||||
if version < 3 then
|
if version < math.floor(CURRENT_VERSION) then
|
||||||
-- v2 to v3
|
-- v2 to v3
|
||||||
migrate_v2_to_v3()
|
migrate_v2_to_v3()
|
||||||
mail.storage:set_int(STORAGE_VERSION_KEY, 3)
|
mail.storage:set_float(STORAGE_VERSION_KEY, CURRENT_VERSION)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check for v1 storage
|
-- check for v1 storage
|
||||||
|
@ -146,9 +146,12 @@ function mail.migrate()
|
||||||
if v1_file then
|
if v1_file then
|
||||||
-- v1 to v3
|
-- v1 to v3
|
||||||
migrate_v1_to_v3()
|
migrate_v1_to_v3()
|
||||||
mail.storage:set_int(STORAGE_VERSION_KEY, 3)
|
mail.storage:set_float(STORAGE_VERSION_KEY, CURRENT_VERSION)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- repair storage for uuid doublons
|
-- repair storage for uuid doublons
|
||||||
repair_storage()
|
if version < CURRENT_VERSION then
|
||||||
|
repair_storage()
|
||||||
|
mail.storage:set_float(STORAGE_VERSION_KEY, CURRENT_VERSION)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue