add v1 and v2 player db examples and migration test

This commit is contained in:
BuckarooBanzay 2023-03-29 08:24:56 +02:00 committed by Athozus
parent a5caecf96e
commit 48fa4b04f8
No known key found for this signature in database
GPG key ID: B50895022E8484BF
7 changed files with 69 additions and 31 deletions

28
migrate.spec.lua Normal file
View file

@ -0,0 +1,28 @@
mtt.register("migrate v1", function(callback)
local entry = mail.get_storage_entry("old_v1_player")
assert(entry)
assert(#entry.inbox == 1)
assert(entry.inbox[1].from == "singleplayer")
assert(entry.inbox[1].to == "old_v1_player")
assert(entry.inbox[1].subject == "test1")
assert(entry.inbox[1].body == "test2")
assert(entry.inbox[1].id)
assert(entry.inbox[1].time > 0)
callback()
end)
mtt.register("migrate v2", function(callback)
local entry = mail.get_storage_entry("old_v2_player")
assert(entry)
assert(#entry.inbox == 1)
assert(entry.inbox[1].from == "someone-else")
assert(entry.inbox[1].to == "old_v2_player")
assert(entry.inbox[1].subject == "test1")
assert(entry.inbox[1].body == "test2")
assert(entry.inbox[1].id)
assert(entry.inbox[1].time == 1678467148)
callback()
end)