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

Function upgrade

eos/db/migrations/upgrade22.py:9–45  ·  view source on GitHub ↗
(saveddata_engine)

Source from the content-addressed store, hash-verified

7
8
9def upgrade(saveddata_engine):
10
11 # 1 = created only
12 # 2 = created and modified
13 tables = {
14 "boosters": 2,
15 "cargo": 2,
16 "characters": 2,
17 # "crest": 1,
18 "damagePatterns": 2,
19 "drones": 2,
20 "fighters": 2,
21 "fits": 2,
22 "projectedFits": 2,
23 "commandFits": 2,
24 "implants": 2,
25 "implantSets": 2,
26 "modules": 2,
27 "overrides": 2,
28 "characterSkills": 2,
29 "targetResists": 2
30 }
31
32 for table in list(tables.keys()):
33
34 # midnight brain, there's probably a much more simple way to do this, but fuck it
35 if tables[table] > 0:
36 try:
37 saveddata_engine.execute("SELECT created FROM {0} LIMIT 1;".format(table))
38 except sqlalchemy.exc.DatabaseError:
39 saveddata_engine.execute("ALTER TABLE {} ADD COLUMN created DATETIME;".format(table))
40
41 if tables[table] > 1:
42 try:
43 saveddata_engine.execute("SELECT modified FROM {0} LIMIT 1;".format(table))
44 except sqlalchemy.exc.DatabaseError:
45 saveddata_engine.execute("ALTER TABLE {} ADD COLUMN modified DATETIME;".format(table))

Callers

nothing calls this directly

Calls 1

keysMethod · 0.45

Tested by

no test coverage detected