Mercurial > wow > breuesk
comparison Core.lua @ 86:22b37c800bc4
Database and comm versioning
author | John@Yosemite-PC |
---|---|
date | Sun, 15 Apr 2012 14:42:14 -0400 |
parents | f938ec08d5a6 |
children | 5ade79caeece |
comparison
equal
deleted
inserted
replaced
85:f938ec08d5a6 | 86:22b37c800bc4 |
---|---|
4 -- (*) lists fully functional (/script interface) | 4 -- (*) lists fully functional (/script interface) |
5 -- (*) lists single-user functional via command line interface | 5 -- (*) lists single-user functional via command line interface |
6 -- (*) all actions should reference the player list rather than player names | 6 -- (*) all actions should reference the player list rather than player names |
7 -- (?) player entries should persist as long as any list or change references | 7 -- (?) player entries should persist as long as any list or change references |
8 -- (*) lists store number slots rather than flat indexing | 8 -- (*) lists store number slots rather than flat indexing |
9 -- ( ) database and comm versioning | 9 -- (*) database and comm versioning |
10 -- (_) limited communication - everyone trusts the loot master | 10 -- (_) limited communication - everyone trusts the loot master |
11 -- (*) single user + admin gui (manual suicides) | 11 -- (*) single user + admin gui (manual suicides) |
12 -- (*) single user + admin gui (master loot) | 12 -- (*) single user + admin gui (master loot) |
13 -- (*) whisper UI | 13 -- (*) whisper UI |
14 -- (_) communication and list merging/trimming | 14 -- (_) communication and list merging/trimming |
36 -- 2) a.x === a["x"] | 36 -- 2) a.x === a["x"] |
37 -- 3) a["1"] =/= a[1] | 37 -- 3) a["1"] =/= a[1] |
38 -- 4) table.remove() works ok if reverse iterating, terrible at anything else | 38 -- 4) table.remove() works ok if reverse iterating, terrible at anything else |
39 -- 5) pairs() does not have a guaranteed iteration order | 39 -- 5) pairs() does not have a guaranteed iteration order |
40 | 40 |
41 dbversion = 1 | |
42 commversion = 1 | |
43 | |
41 function OnInitialize() | 44 function OnInitialize() |
42 | 45 |
43 debug = true | 46 debug = true |
44 | 47 |
45 db = _G.LibStub("AceDB-3.0"):New("BskDB", defaults, "Default") | 48 db = _G.LibStub("AceDB-3.0"):New("BskDB", defaults, "Default") |
47 options.args.profile = _G.LibStub("AceDBOptions-3.0"):GetOptionsTable(db) | 50 options.args.profile = _G.LibStub("AceDBOptions-3.0"):GetOptionsTable(db) |
48 _G.LibStub("AceConfig-3.0"):RegisterOptionsTable("bsk", options) | 51 _G.LibStub("AceConfig-3.0"):RegisterOptionsTable("bsk", options) |
49 --optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("bsk", "bsk") | 52 --optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("bsk", "bsk") |
50 | 53 |
51 admin = db.profile.admin | 54 admin = db.profile.admin |
55 if not db.profile.dbversion or db.profile.dbversion < dbversion then | |
56 UpgradeDB() | |
57 end | |
52 | 58 |
53 local HandlePassThrough = function(...) HandleCommand(...) end | 59 local HandlePassThrough = function(...) HandleCommand(...) end |
54 bsk:RegisterChatCommand("bsk", HandlePassThrough) | 60 bsk:RegisterChatCommand("bsk", HandlePassThrough) |
55 bsk:OnInitializeSetStaticData() | 61 bsk:OnInitializeSetStaticData() |
56 InitializeComm() | 62 InitializeComm() |
207 changes = {}, | 213 changes = {}, |
208 lists = {} | 214 lists = {} |
209 } | 215 } |
210 } | 216 } |
211 | 217 |
218 function UpgradeDB() | |
219 local mydbver = db.profile.dbversion or 0 | |
220 | |
221 if mydbver == 0 then -- difference between 0 and 1 is whether this field is present | |
222 db.profile.dbversion = 1 | |
223 mydbver = 1 | |
224 end | |
225 | |
226 | |
227 end |