kopia lustrzana https://github.com/bugout-dev/moonstream
57 wiersze
3.5 KiB
Python
57 wiersze
3.5 KiB
Python
"""Drop pending tx table
|
|
|
|
Revision ID: 3d55105b0603
|
|
Revises: 0b46c8e17bf2
|
|
Create Date: 2021-11-08 10:03:18.246561
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '3d55105b0603'
|
|
down_revision = '0b46c8e17bf2'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index('ix_ethereum_pending_transactions_block_number', table_name='ethereum_pending_transactions')
|
|
op.drop_index('ix_ethereum_pending_transactions_from_address', table_name='ethereum_pending_transactions')
|
|
op.drop_index('ix_ethereum_pending_transactions_gas', table_name='ethereum_pending_transactions')
|
|
op.drop_index('ix_ethereum_pending_transactions_gas_price', table_name='ethereum_pending_transactions')
|
|
op.drop_index('ix_ethereum_pending_transactions_hash', table_name='ethereum_pending_transactions')
|
|
op.drop_index('ix_ethereum_pending_transactions_to_address', table_name='ethereum_pending_transactions')
|
|
op.drop_index('ix_ethereum_pending_transactions_value', table_name='ethereum_pending_transactions')
|
|
op.drop_table('ethereum_pending_transactions')
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('ethereum_pending_transactions',
|
|
sa.Column('hash', sa.VARCHAR(length=256), autoincrement=False, nullable=False),
|
|
sa.Column('block_number', sa.BIGINT(), autoincrement=False, nullable=False),
|
|
sa.Column('from_address', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
|
|
sa.Column('to_address', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
|
|
sa.Column('gas', sa.NUMERIC(precision=78, scale=0), autoincrement=False, nullable=True),
|
|
sa.Column('gas_price', sa.NUMERIC(precision=78, scale=0), autoincrement=False, nullable=True),
|
|
sa.Column('input', sa.TEXT(), autoincrement=False, nullable=True),
|
|
sa.Column('nonce', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
|
|
sa.Column('transaction_index', sa.BIGINT(), autoincrement=False, nullable=True),
|
|
sa.Column('value', sa.NUMERIC(precision=78, scale=0), autoincrement=False, nullable=True),
|
|
sa.Column('indexed_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text("timezone('utc'::text, statement_timestamp())"), autoincrement=False, nullable=False),
|
|
sa.ForeignKeyConstraint(['block_number'], ['ethereum_blocks.block_number'], name='fk_ethereum_pending_transactions_block_number_ethereum_blocks', ondelete='CASCADE'),
|
|
sa.PrimaryKeyConstraint('hash', name='pk_ethereum_pending_transactions')
|
|
)
|
|
op.create_index('ix_ethereum_pending_transactions_value', 'ethereum_pending_transactions', ['value'], unique=False)
|
|
op.create_index('ix_ethereum_pending_transactions_to_address', 'ethereum_pending_transactions', ['to_address'], unique=False)
|
|
op.create_index('ix_ethereum_pending_transactions_hash', 'ethereum_pending_transactions', ['hash'], unique=False)
|
|
op.create_index('ix_ethereum_pending_transactions_gas_price', 'ethereum_pending_transactions', ['gas_price'], unique=False)
|
|
op.create_index('ix_ethereum_pending_transactions_gas', 'ethereum_pending_transactions', ['gas'], unique=False)
|
|
op.create_index('ix_ethereum_pending_transactions_from_address', 'ethereum_pending_transactions', ['from_address'], unique=False)
|
|
op.create_index('ix_ethereum_pending_transactions_block_number', 'ethereum_pending_transactions', ['block_number'], unique=False)
|
|
# ### end Alembic commands ###
|