MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / update

Function update

eos/db/migration.py:20–44  ·  view source on GitHub ↗
(saveddata_engine)

Source from the content-addressed store, hash-verified

18
19
20def update(saveddata_engine):
21 dbVersion = getVersion(saveddata_engine)
22 appVersion = getAppVersion()
23
24 if dbVersion == appVersion:
25 return
26
27 if dbVersion < appVersion:
28 # Automatically backup database
29 toFile = "%s/saveddata_migration_%d-%d_%s.db" % (
30 config.savePath,
31 dbVersion,
32 appVersion,
33 time.strftime("%Y%m%d_%H%M%S"))
34
35 shutil.copyfile(config.saveDB, toFile)
36
37 for version in range(dbVersion, appVersion):
38 func = migrations.updates[version + 1]
39 if func:
40 pyfalog.info("Applying database update: {0}", version + 1)
41 func(saveddata_engine)
42
43 # when all is said and done, set version to current
44 saveddata_engine.execute("PRAGMA user_version = {}".format(appVersion))

Callers

nothing calls this directly

Calls 2

getAppVersionFunction · 0.85
getVersionFunction · 0.70

Tested by

no test coverage detected