Merge branch 'master' into singularity
This commit is contained in:
@@ -1,32 +1,36 @@
|
||||
import config
|
||||
import shutil
|
||||
import time
|
||||
import os
|
||||
|
||||
def getVersion(db):
|
||||
cursor = db.execute('PRAGMA user_version')
|
||||
return cursor.fetchone()[0]
|
||||
|
||||
def update(saveddata_engine):
|
||||
currversion = getVersion(saveddata_engine)
|
||||
dbVersion = getVersion(saveddata_engine)
|
||||
|
||||
if currversion == config.dbversion:
|
||||
files = os.listdir(os.path.join(os.path.dirname(__file__), "migrations"))
|
||||
appVersion = len([f for f in files if f.startswith("upgrade")])
|
||||
|
||||
if dbVersion == appVersion:
|
||||
return
|
||||
|
||||
if currversion < config.dbversion:
|
||||
if dbVersion < appVersion:
|
||||
# Automatically backup database
|
||||
toFile = "%s/saveddata_migration_%d-%d_%s.db"%(
|
||||
config.savePath,
|
||||
currversion,
|
||||
config.dbversion,
|
||||
dbVersion,
|
||||
appVersion,
|
||||
time.strftime("%Y%m%d_%H%M%S"))
|
||||
|
||||
shutil.copyfile(config.saveDB, toFile)
|
||||
|
||||
for version in xrange(currversion, config.dbversion):
|
||||
for version in xrange(dbVersion, appVersion):
|
||||
module = __import__('eos.db.migrations.upgrade%d'%(version+1), fromlist=True)
|
||||
upgrade = getattr(module, "upgrade", False)
|
||||
if upgrade:
|
||||
upgrade(saveddata_engine)
|
||||
|
||||
# when all is said and done, set version to current
|
||||
saveddata_engine.execute('PRAGMA user_version = %d'%config.dbversion)
|
||||
saveddata_engine.execute('PRAGMA user_version = %d'%appVersion)
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
"""
|
||||
Migration 4
|
||||
Migration 8
|
||||
|
||||
- Converts modules based on Proteus Module Tiericide
|
||||
- Converts modules based on Carnyx Module Tiericide
|
||||
Some modules have been unpublished (and unpublished module attributes are removed
|
||||
from database), which causes pyfa to crash. We therefore replace these
|
||||
modules with their new replacements
|
||||
|
||||
Based on http://community.eveonline.com/news/patch-notes/patch-notes-for-proteus/
|
||||
and output of itemDiff.py
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class Price(object):
|
||||
def __init__(self, typeID):
|
||||
self.typeID = typeID
|
||||
self.time = 0
|
||||
self.price = 0
|
||||
self.failed = None
|
||||
self.__item = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user