"""added state and storage tables

Revision ID: ef91a56cb621
Revises: 4722e540ad36
Create Date: 2018-06-15 14:55:03.248439

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '4722e540ad36'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('state_diff',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('block_number', sa.Numeric(), nullable=True),
    sa.Column('timestamp', sa.TIMESTAMP(), nullable=True),
    sa.Column('transaction_hash', sa.String(length=66), nullable=True),
    sa.Column('transaction_index', sa.Numeric(), nullable=True),
    sa.Column('address', sa.String(length=42), nullable=True),
    sa.Column('balance_diff', sa.Numeric(), nullable=True),
    sa.Column('nonce_diff', sa.Integer(), nullable=True),
    sa.Column('code_from', sa.Text(), nullable=True),
    sa.Column('code_to', sa.Text(), nullable=True),
    sa.Column('state_diff_type', sa.String(length=10), nullable=True),
    sa.ForeignKeyConstraint(['block_number'], ['blocks.block_number'], ),
    sa.ForeignKeyConstraint(['transaction_hash'], ['transactions.transaction_hash'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_state_diff_address'), 'state_diff', ['address'], unique=False)
    op.create_index(op.f('ix_state_diff_transaction_hash'), 'state_diff', ['transaction_hash'], unique=False)
    op.create_table('storage_diff',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('block_number', sa.Numeric(), nullable=True),
    sa.Column('timestamp', sa.TIMESTAMP(), nullable=True),
    sa.Column('transaction_hash', sa.String(length=66), nullable=True),
    sa.Column('transaction_index', sa.Numeric(), nullable=True),
    sa.Column('state_diff_id', sa.Integer(), nullable=False),
    sa.Column('address', sa.String(length=42), nullable=False),
    sa.Column('position', sa.String(length=66), nullable=False),
    sa.Column('storage_from', sa.String(length=66), nullable=True),
    sa.Column('storage_to', sa.String(length=66), nullable=True),
    sa.ForeignKeyConstraint(['block_number'], ['blocks.block_number'], ),
    sa.ForeignKeyConstraint(['state_diff_id'], ['state_diff.id'], ),
    sa.ForeignKeyConstraint(['transaction_hash'], ['transactions.transaction_hash'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_storage_diff_address'), 'storage_diff', ['address'], unique=False)
    op.create_index(op.f('ix_storage_diff_transaction_hash'), 'storage_diff', ['transaction_hash'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_storage_diff_transaction_hash'), table_name='storage_diff')
    op.drop_index(op.f('ix_storage_diff_address'), table_name='storage_diff')
    op.drop_table('storage_diff')
    op.drop_index(op.f('ix_state_diff_transaction_hash'), table_name='state_diff')
    op.drop_index(op.f('ix_state_diff_address'), table_name='state_diff')
    op.drop_table('state_diff')
    # ### end Alembic commands ###

"""added state and storage tables

Revision ID: ef91a56cb621
Revises: 4722e540ad36
Create Date: 2018-06-15 14:55:03.248439

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '4722e540ad36'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('state_diff',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('block_number', sa.Numeric(), nullable=True),
    sa.Column('timestamp', sa.TIMESTAMP(), nullable=True),
    sa.Column('transaction_hash', sa.String(length=66), nullable=True),
    sa.Column('transaction_index', sa.Numeric(), nullable=True),
    sa.Column('address', sa.String(length=42), nullable=True),
    sa.Column('balance_diff', sa.Numeric(), nullable=True),
    sa.Column('nonce_diff', sa.Integer(), nullable=True),
    sa.Column('code_from', sa.Text(), nullable=True),
    sa.Column('code_to', sa.Text(), nullable=True),
    sa.Column('state_diff_type', sa.String(length=10), nullable=True),
    sa.ForeignKeyConstraint(['block_number'], ['blocks.block_number'], ),
    sa.ForeignKeyConstraint(['transaction_hash'], ['transactions.transaction_hash'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_state_diff_address'), 'state_diff', ['address'], unique=False)
    op.create_index(op.f('ix_state_diff_transaction_hash'), 'state_diff', ['transaction_hash'], unique=False)
    op.create_table('storage_diff',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('block_number', sa.Numeric(), nullable=True),
    sa.Column('timestamp', sa.TIMESTAMP(), nullable=True),
    sa.Column('transaction_hash', sa.String(length=66), nullable=True),
    sa.Column('transaction_index', sa.Numeric(), nullable=True),
    sa.Column('state_diff_id', sa.Integer(), nullable=False),
    sa.Column('address', sa.String(length=42), nullable=False),
    sa.Column('position', sa.String(length=66), nullable=False),
    sa.Column('storage_from', sa.String(length=66), nullable=True),
    sa.Column('storage_to', sa.String(length=66), nullable=True),
    sa.ForeignKeyConstraint(['block_number'], ['blocks.block_number'], ),
    sa.ForeignKeyConstraint(['state_diff_id'], ['state_diff.id'], ),
    sa.ForeignKeyConstraint(['transaction_hash'], ['transactions.transaction_hash'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_storage_diff_address'), 'storage_diff', ['address'], unique=False)
    op.create_index(op.f('ix_storage_diff_transaction_hash'), 'storage_diff', ['transaction_hash'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_storage_diff_transaction_hash'), table_name='storage_diff')
    op.drop_index(op.f('ix_storage_diff_address'), table_name='storage_diff')
    op.drop_table('storage_diff')
    op.drop_index(op.f('ix_state_diff_transaction_hash'), table_name='state_diff')
    op.drop_index(op.f('ix_state_diff_address'), table_name='state_diff')
    op.drop_table('state_diff')
    # ### end Alembic commands ###

added state and storage tables  Revision ID: ef91a56cb621 Revises: 4722e540ad36 Create Date: 2018-06-15 14:55:03.248439 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###