moonstream/db/alembic/versions/571f33ad7587_ethereum_smart...

39 wiersze
1.6 KiB
Python

"""Ethereum smart contracts
Revision ID: 571f33ad7587
Revises: 21cced47077c
Create Date: 2021-07-30 09:00:18.945935
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '571f33ad7587'
down_revision = '21cced47077c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('ethereum_smart_contracts',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('address', sa.VARCHAR(length=256), nullable=False),
sa.ForeignKeyConstraint(['transaction_hash'], ['ethereum_transactions.hash'], name=op.f('fk_ethereum_smart_contracts_transaction_hash_ethereum_transactions'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id', name=op.f('pk_ethereum_smart_contracts'))
)
op.create_index(op.f('ix_ethereum_smart_contracts_address'), 'ethereum_smart_contracts', ['address'], unique=False)
op.create_index(op.f('ix_ethereum_smart_contracts_transaction_hash'), 'ethereum_smart_contracts', ['transaction_hash'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_ethereum_smart_contracts_transaction_hash'), table_name='ethereum_smart_contracts')
op.drop_index(op.f('ix_ethereum_smart_contracts_address'), table_name='ethereum_smart_contracts')
op.drop_table('ethereum_smart_contracts')
# ### end Alembic commands ###