Fix old migrations

This commit is contained in:
blitzmann
2014-11-18 18:55:03 -05:00
parent 399ec7d009
commit 9831ed5c3d
3 changed files with 22 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ evemonMinVersion = "4081"
# Database version (int ONLY)
# Increment every time we need to flag for user database upgrade/modification
dbversion = 1
dbversion = 2
pyfaPath = None
savePath = None

View File

@@ -1,7 +1,6 @@
"""
Migration 1
- Includes old upgrade paths pre-1.5.0
- Alters fits table to introduce target resist attribute
- Converts modules based on Oceanus Module Tiericide
Some modules have been deleted, which causes pyfa to crash when fits are
@@ -84,20 +83,6 @@ CONVERSIONS = {
}
def upgrade(saveddata_engine):
# Update characters schema to include default chars (pre-1.5.0 migration)
try:
saveddata_engine.execute("SELECT defaultChar, chars FROM characters LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN defaultChar INTEGER;")
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN chars VARCHAR;")
# Update fits schema to include booster attribute (pre-1.5.0 migration)
try:
saveddata_engine.execute("SELECT booster FROM fits LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN booster BOOLEAN;")
# Update fits schema to include target resists attribute
try:
saveddata_engine.execute("SELECT targetResistsID FROM fits LIMIT 1")

View File

@@ -0,0 +1,21 @@
"""
Migration 2
- Includes old upgrade paths pre-1.5.0. See GH issue #190 for why this is needed
"""
import sqlalchemy
def upgrade(saveddata_engine):
# Update characters schema to include default chars
try:
saveddata_engine.execute("SELECT defaultChar, chars FROM characters LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN defaultChar INTEGER")
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN chars VARCHAR")
# Update fits schema to include booster attribute
try:
saveddata_engine.execute("SELECT booster FROM fits LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN booster BOOLEAN")