Skip to content

Commit 9831ed5

Browse files
committed
Fix old migrations
1 parent 399ec7d commit 9831ed5

3 files changed

Lines changed: 22 additions & 16 deletions

File tree

config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# Database version (int ONLY)
2323
# Increment every time we need to flag for user database upgrade/modification
24-
dbversion = 1
24+
dbversion = 2
2525

2626
pyfaPath = None
2727
savePath = None

eos/db/migrations/upgrade1.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
22
Migration 1
33
4-
- Includes old upgrade paths pre-1.5.0
54
- Alters fits table to introduce target resist attribute
65
- Converts modules based on Oceanus Module Tiericide
76
Some modules have been deleted, which causes pyfa to crash when fits are
@@ -84,20 +83,6 @@
8483
}
8584

8685
def upgrade(saveddata_engine):
87-
88-
# Update characters schema to include default chars (pre-1.5.0 migration)
89-
try:
90-
saveddata_engine.execute("SELECT defaultChar, chars FROM characters LIMIT 1")
91-
except sqlalchemy.exc.DatabaseError:
92-
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN defaultChar INTEGER;")
93-
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN chars VARCHAR;")
94-
95-
# Update fits schema to include booster attribute (pre-1.5.0 migration)
96-
try:
97-
saveddata_engine.execute("SELECT booster FROM fits LIMIT 1")
98-
except sqlalchemy.exc.DatabaseError:
99-
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN booster BOOLEAN;")
100-
10186
# Update fits schema to include target resists attribute
10287
try:
10388
saveddata_engine.execute("SELECT targetResistsID FROM fits LIMIT 1")

eos/db/migrations/upgrade2.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Migration 2
3+
4+
- Includes old upgrade paths pre-1.5.0. See GH issue #190 for why this is needed
5+
"""
6+
7+
import sqlalchemy
8+
9+
def upgrade(saveddata_engine):
10+
# Update characters schema to include default chars
11+
try:
12+
saveddata_engine.execute("SELECT defaultChar, chars FROM characters LIMIT 1")
13+
except sqlalchemy.exc.DatabaseError:
14+
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN defaultChar INTEGER")
15+
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN chars VARCHAR")
16+
17+
# Update fits schema to include booster attribute
18+
try:
19+
saveddata_engine.execute("SELECT booster FROM fits LIMIT 1")
20+
except sqlalchemy.exc.DatabaseError:
21+
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN booster BOOLEAN")

0 commit comments

Comments
 (0)