Add migration to update fits tablet for implant source
This commit is contained in:
@@ -4,6 +4,9 @@ import time
|
||||
import re
|
||||
import os
|
||||
import migrations
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def getVersion(db):
|
||||
cursor = db.execute('PRAGMA user_version')
|
||||
@@ -30,10 +33,9 @@ def update(saveddata_engine):
|
||||
shutil.copyfile(config.saveDB, toFile)
|
||||
|
||||
for version in xrange(dbVersion, appVersion):
|
||||
|
||||
func = migrations.updates[version+1]
|
||||
if func:
|
||||
print "applying update",version+1
|
||||
logger.info("Applying database update: %d", version+1)
|
||||
func(saveddata_engine)
|
||||
|
||||
# when all is said and done, set version to current
|
||||
|
||||
15
eos/db/migrations/upgrade13.py
Normal file
15
eos/db/migrations/upgrade13.py
Normal file
@@ -0,0 +1,15 @@
|
||||
"""
|
||||
Migration 13
|
||||
|
||||
- Alters fits table to introduce implant location attribute
|
||||
"""
|
||||
|
||||
import sqlalchemy
|
||||
|
||||
def upgrade(saveddata_engine):
|
||||
# Update fits schema to include implant location attribute
|
||||
try:
|
||||
saveddata_engine.execute("SELECT implantLocation FROM fits LIMIT 1")
|
||||
except sqlalchemy.exc.DatabaseError:
|
||||
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN implantLocation INTEGER;")
|
||||
saveddata_engine.execute("UPDATE fits SET implantLocation = 0")
|
||||
Reference in New Issue
Block a user