"""Add block height and hash in TransactionInput

Revision ID: 4e05d0e982d4
Revises: 38bb38e30003
Create Date: 2014-07-09 18:18:36.315968

"""

# revision identifiers, used by Alembic.
revision = '4e05d0e982d4'
down_revision = '38bb38e30003'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('transaction_vin', sa.Column('block_hash', sa.String(length=250), nullable=True))
    op.add_column('transaction_vin', sa.Column('block_height', sa.Integer(), nullable=True))
    op.create_index(op.f('ix_transaction_vin_block_hash'), 'transaction_vin', ['block_hash'], unique=False)
    op.create_index(op.f('ix_transaction_vin_block_height'), 'transaction_vin', ['block_height'], unique=False)
    op.create_index('ix_transaction_output_txid_and_offset', 'transaction_vout', ['txid', 'offset'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_transaction_output_txid_and_offset', table_name='transaction_vout')
    op.drop_index(op.f('ix_transaction_vin_block_height'), table_name='transaction_vin')
    op.drop_index(op.f('ix_transaction_vin_block_hash'), table_name='transaction_vin')
    op.drop_column('transaction_vin', 'block_height')
    op.drop_column('transaction_vin', 'block_hash')
    ### end Alembic commands ###
