Add upgrade which adds spoolup attributes to database

This commit is contained in:
DarkPhoenix
2018-12-10 11:24:32 +03:00
parent f4123310ae
commit 47a97772cf

View File

@@ -0,0 +1,18 @@
"""
Migration 29
- adds spoolType and spoolAmount to modules table
"""
import sqlalchemy
def upgrade(saveddata_engine):
try:
saveddata_engine.execute("SELECT spoolType FROM modules LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE modules ADD COLUMN spoolType INT;")
try:
saveddata_engine.execute("SELECT spoolAmount FROM modules LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE modules ADD COLUMN spoolAmount FLOAT;")