Add try/catch block to upgrade function until better solution is found

This commit is contained in:
Samuel Mehrbrodt 2014-03-30 23:49:55 +02:00
parent 88c641715c
commit ad982e9fa3

View File

@ -104,6 +104,9 @@ def upgrade_4(session, metadata):
This upgrade adds a column for author type to the authors_songs table
"""
op = get_upgrade_op(session)
op.add_column('authors_songs', Column('author_type', types.String(), primary_key=True,
nullable=False, server_default=text('""')))
try:
op = get_upgrade_op(session)
op.add_column('authors_songs', Column('author_type', types.String(), primary_key=True,
nullable=False, server_default=text('""')))
except OperationalError:
log.info('Upgrade 4 has already been run')