"""Add results relation

Revision ID: 3bea38dae933
Revises: 44bce379d3ad
Create Date: 2018-09-16 01:45:42.737655

"""
from alembic import op
import sqlalchemy as sa
import sq.ext.rdbms.types


# revision identifiers, used by Alembic.
revision = '3bea38dae933'
down_revision = '44bce379d3ad'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('results',
    sa.Column('txid', sa.String(), nullable=False),
    sa.Column('issuer_id', sa.String(), nullable=False),
    sa.Column('data', sa.String(), nullable=False),
    sa.Column('checksum', sa.LargeBinary(), nullable=False),
    sa.Column('retrieved', sa.BigInteger(), nullable=False),
    sa.Column('timestamped', sa.Boolean(), nullable=False),
    sa.ForeignKeyConstraint(['txid'], ['transactions.txid'], ),
    sa.PrimaryKeyConstraint('txid')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('results')
    # ### end Alembic commands ###
