end |
|
function addon:upgrade() |
-- Upgrade database from previous version |
-- Remove obsolete sink data from previous versions (=<0.7) |
if db.sinkStorage1 then |
db.sinkStorage1 = nil |
end |
if db.sinkStorage2 then |
db.sinkStorage2 = nil |
end |
if db.sinkStorage3 then |
db.sinkStorage3 = nil |
end |
if db.sinkStorage4 then |
db.sinkStorage4 = nil |
end |
|
-- Upgrade data format from previous versions (=<0.6) |
if not db.spell then return end |
Print("Upgrading database") |
local keys = { chat = true, chatTarget = true, whisper = true, whisperTarget = true } |
db.spells = addon:deepcopy(db.spell) |
for k,_ in pairs(db.spell) do |
Print(" Checking: " .. k) |
Print(" Importing: " .. k) |
for key,_ in pairs(keys) do |
if not db.spell[k].msgFormat[key] then |
db.spells[k].msgFormat[key] = addon:deepcopy(db.customMsgFormat[key]) |