"""Add build.deps_resolved field

Revision ID: 4be96f2685d
Revises: 538a778fcd5d
Create Date: 2015-03-06 13:58:38.127810

"""

# revision identifiers, used by Alembic.
revision = '4be96f2685d'
down_revision = '538a778fcd5d'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('build', sa.Column('deps_resolved', sa.Boolean(), server_default='false', nullable=False))
    op.execute("""update build set deps_resolved=true where exists (select id from dependency_change where applied_in_id=build.id)""")
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('build', 'deps_resolved')
    ### end Alembic commands ###
