comparison Core.lua @ 217:ca05b8ade1ea

Removed old database patcher. Don?t think anybody needs it anymore and it just acts confusing.
author Zerotorescue
date Sun, 06 Feb 2011 19:26:59 +0100
parents fbd52851dcd1
children c04257b42b03
comparison
equal deleted inserted replaced
216:70daa765e275 217:ca05b8ade1ea
151 151
152 function addon:UpdateDatabase() 152 function addon:UpdateDatabase()
153 if not self.db.global.version or self.db.global.version < addonRevision then 153 if not self.db.global.version or self.db.global.version < addonRevision then
154 -- Is our database outdated? Then patch it. 154 -- Is our database outdated? Then patch it.
155 155
156 if not self.db.global.version then 156 --[[if self.db.global.version < 1337 then
157 -- Old version was before version was saved, many changes were done in that revision 157 end]]
158
159 addon:Print("Updating Inventorium database from version " .. (self.db.global.version or "Unknown") .. " to version " .. addonRevision .. "...");
160
161 if self.db.global and self.db.global.defaults then
162 addon:Print("Moving all global data into your current profile...");
163
164 -- All data mustn't be global but profile-based
165 self.db.profile.defaults = CopyTable(self.db.global.defaults);
166 self.db.profile.groups = CopyTable(self.db.global.groups);
167
168 self.db.global.defaults = nil;
169 self.db.global.groups = nil;
170
171 self.CommandHandler = function()
172 message("You must /reload once to finalize the Inventorium database updates. This will only be required once during the BETA.");
173 end;
174 self:CommandHandler();
175 end
176
177 if self.db.profile.defaults.minimumStock then
178 addon:Print("Copying the minimum stock value into the minimum global stock...");
179
180 -- We added another stock option and renamed the old to be more obvious about what it means
181 self.db.profile.defaults.minGlobalStock = self.db.profile.defaults.minimumStock;
182 self.db.profile.defaults.minimumStock = nil;
183 end
184
185 if self.db.profile.defaults.minimumLocalStock then
186 addon:Print("Renaming the minimum local stock property...");
187
188 -- We added another stock option and then renamed it
189 self.db.profile.defaults.minLocalStock = self.db.profile.defaults.minimumLocalStock;
190 self.db.profile.defaults.minimumLocalStock = nil;
191 end
192
193 if self.db.profile.defaults.alertBelowMinimum then
194 addon:Print("Copying the alert below minimum value into the alert below global minimum value...");
195
196 -- We added another stock option and then renamed it
197 self.db.profile.defaults.alertBelowGlobalMinimum = self.db.profile.defaults.alertBelowMinimum;
198 self.db.profile.defaults.alertBelowMinimum = nil;
199 end
200
201 -- Go through all groups to see if there's one with the above two renamed variables
202 for groupName, values in pairs(self.db.profile.groups) do
203 if values.minimumStock then
204 values.minGlobalStock = values.minimumStock;
205 values.minimumStock = nil;
206 end
207 end
208 -- end of old version which didn't have version numbers recorded
209 end
210 158
211 -- Remember the version of our database 159 -- Remember the version of our database
212 self.db.global.version = addonRevision; 160 self.db.global.version = addonRevision;
213 end 161 end
214 end 162 end