Added booster fit toggling in database, menu label toggling, and migration code
This commit is contained in:
@@ -3,7 +3,7 @@ import sqlalchemy
|
||||
def update(saveddata_engine):
|
||||
checkPriceFailures(saveddata_engine)
|
||||
checkApiDefaultChar(saveddata_engine)
|
||||
|
||||
checkFitBooster(saveddata_engine)
|
||||
|
||||
def checkPriceFailures(saveddata_engine):
|
||||
# Check if we have 'failed' column
|
||||
@@ -39,3 +39,21 @@ def checkApiDefaultChar(saveddata_engine):
|
||||
except sqlalchemy.exc.DatabaseError:
|
||||
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN defaultChar INTEGER;")
|
||||
saveddata_engine.execute("ALTER TABLE characters ADD COLUMN chars VARCHAR;")
|
||||
|
||||
def checkFitBooster(saveddata_engine):
|
||||
try:
|
||||
saveddata_engine.execute("SELECT * FROM fits LIMIT 1")
|
||||
# If table doesn't exist, it means we're doing everything from scratch
|
||||
# and sqlalchemy will process everything as needed
|
||||
except sqlalchemy.exc.DatabaseError:
|
||||
pass
|
||||
# If not, we're running on top of existing DB
|
||||
else:
|
||||
# Check that we have columns
|
||||
try:
|
||||
saveddata_engine.execute("SELECT booster FROM fits LIMIT 1")
|
||||
# If we don't, create them
|
||||
# This is ugly as hell, but we can't use proper migrate packages as it
|
||||
# will require us to rebuild skeletons, including mac
|
||||
except sqlalchemy.exc.DatabaseError:
|
||||
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN booster BOOLEAN;")
|
||||
@@ -17,7 +17,7 @@
|
||||
# along with eos. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
from sqlalchemy import Table, Column, Integer, ForeignKey, String
|
||||
from sqlalchemy import Table, Column, Integer, ForeignKey, String, Boolean
|
||||
from sqlalchemy.orm import relation, mapper
|
||||
from sqlalchemy.sql import and_
|
||||
|
||||
@@ -36,7 +36,8 @@ fits_table = Table("fits", saveddata_meta,
|
||||
Column("name", String, nullable = False),
|
||||
Column("timestamp", Integer, nullable = False),
|
||||
Column("characterID", ForeignKey("characters.ID"), nullable = True),
|
||||
Column("damagePatternID", ForeignKey("damagePatterns.ID"), nullable=True))
|
||||
Column("damagePatternID", ForeignKey("damagePatterns.ID"), nullable=True),
|
||||
Column("booster", Boolean, nullable = False, index = True))
|
||||
|
||||
projectedFits_table = Table("projectedFits", saveddata_meta,
|
||||
Column("sourceID", ForeignKey("fits.ID"), primary_key = True),
|
||||
|
||||
Reference in New Issue
Block a user