boartty/gertty/alembic/versions/7ef7dfa2ca3a_add_change_outdated.py
James E. Blair eeef69ed5f Add an outdated flag for changes
If we detect that a change sync has failed, mark that change as
outdated in the local database so that if it has failed in such a
way that Gertty continues to process its queue and eventually stamp
a project or query as up-to-date, it can go back later and try to
sync the failed change again.

NB: This change contains a schema migration.

Change-Id: Ieb22a510a8096d77c12d30aefbedd36f7f3037b0
2016-08-09 09:32:55 -07:00

38 lines
846 B
Python

"""add change.outdated
Revision ID: 7ef7dfa2ca3a
Revises: 37a702b7f58e
Create Date: 2016-08-09 08:59:04.441926
"""
# revision identifiers, used by Alembic.
revision = '7ef7dfa2ca3a'
down_revision = '37a702b7f58e'
import warnings
from alembic import op
import sqlalchemy as sa
from gertty.dbsupport import sqlite_alter_columns
def upgrade():
with warnings.catch_warnings():
warnings.simplefilter("ignore")
op.add_column('change', sa.Column('outdated', sa.Boolean()))
connection = op.get_bind()
change = sa.sql.table('change',
sa.sql.column('outdated', sa.Boolean()))
connection.execute(change.update().values({'outdated':False}))
sqlite_alter_columns('change', [
sa.Column('outdated', sa.Boolean(), index=True, nullable=False),
])
def downgrade():
pass