Delete broken references to in commandFits (#844)

This commit is contained in:
blitzman
2016-11-28 21:07:09 -05:00
parent 0d874f9ad1
commit b2cf4b8aa5

View File

@@ -0,0 +1,20 @@
"""
Migration 19
- Deletes broken references to fits from the commandFits table (see GH issue #844)
"""
import sqlalchemy
def upgrade(saveddata_engine):
from eos.db import saveddata_session
sql = """
DELETE FROM commandFits
WHERE boosterID NOT IN (select ID from fits)
OR boostedID NOT IN (select ID from fits)
"""
saveddata_session.execute(sql)
saveddata_session.commit()