Skip to content

Commit

Permalink
Merge pull request HemeraProtocol#176 from HemeraProtocol/chore/lint_fix
Browse files Browse the repository at this point in the history
Lint fix
  • Loading branch information
shanshuo0918 authored Sep 29, 2024
2 parents 9ba1ed2 + 7cba519 commit f0ab857
Showing 1 changed file with 83 additions and 58 deletions.
141 changes: 83 additions & 58 deletions migrations/versions/20240927_add_merchant_moe_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,108 @@
Create Date: 2024-09-27 17:00:46.320469
"""

from typing import Sequence, Union

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

# revision identifiers, used by Alembic.
revision: str = '67015d9fa59b'
down_revision: Union[str, None] = 'c609922eae7a'
revision: str = "67015d9fa59b"
down_revision: Union[str, None] = "c609922eae7a"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('af_merchant_moe_pool_data_current',
sa.Column('pool_address', postgresql.BYTEA(), nullable=False),
sa.Column('block_timestamp', sa.BIGINT(), nullable=True),
sa.Column('block_number', sa.BIGINT(), nullable=True),
sa.Column('active_id', sa.BIGINT(), nullable=True),
sa.Column('bin_step', sa.BIGINT(), nullable=True),
sa.Column('create_time', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
sa.Column('update_time', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
sa.Column('reorg', sa.BOOLEAN(), nullable=True),
sa.PrimaryKeyConstraint('pool_address')
op.create_table(
"af_merchant_moe_pool_data_current",
sa.Column("pool_address", postgresql.BYTEA(), nullable=False),
sa.Column("block_timestamp", sa.BIGINT(), nullable=True),
sa.Column("block_number", sa.BIGINT(), nullable=True),
sa.Column("active_id", sa.BIGINT(), nullable=True),
sa.Column("bin_step", sa.BIGINT(), nullable=True),
sa.Column("create_time", postgresql.TIMESTAMP(), server_default=sa.text("now()"), nullable=True),
sa.Column("update_time", postgresql.TIMESTAMP(), server_default=sa.text("now()"), nullable=True),
sa.Column("reorg", sa.BOOLEAN(), nullable=True),
sa.PrimaryKeyConstraint("pool_address"),
)
op.create_table(
"af_merchant_moe_pool_data_hist",
sa.Column("pool_address", postgresql.BYTEA(), nullable=False),
sa.Column("block_timestamp", sa.BIGINT(), nullable=False),
sa.Column("block_number", sa.BIGINT(), nullable=False),
sa.Column("active_id", sa.BIGINT(), nullable=True),
sa.Column("bin_step", sa.BIGINT(), nullable=True),
sa.Column("create_time", postgresql.TIMESTAMP(), server_default=sa.text("now()"), nullable=True),
sa.Column("update_time", postgresql.TIMESTAMP(), server_default=sa.text("now()"), nullable=True),
sa.Column("reorg", sa.BOOLEAN(), nullable=True),
sa.PrimaryKeyConstraint("pool_address", "block_timestamp", "block_number"),
)
op.create_table(
"af_staked_fbtc_current",
sa.Column("vault_address", postgresql.BYTEA(), nullable=False),
sa.Column("wallet_address", postgresql.BYTEA(), nullable=False),
sa.Column("block_number", sa.BIGINT(), nullable=True),
sa.Column("block_timestamp", sa.BIGINT(), nullable=True),
sa.Column("amount", sa.NUMERIC(precision=100), nullable=True),
sa.Column("changed_amount", sa.NUMERIC(precision=100), nullable=True),
sa.Column("protocol_id", sa.VARCHAR(), nullable=True),
sa.Column("create_time", postgresql.TIMESTAMP(), server_default=sa.text("now()"), nullable=True),
sa.Column("update_time", postgresql.TIMESTAMP(), server_default=sa.text("now()"), nullable=True),
sa.PrimaryKeyConstraint("vault_address", "wallet_address"),
)
op.create_index(
"af_staked_fbtc_current_protocol_block_desc_index",
"af_staked_fbtc_current",
[sa.text("protocol_id DESC")],
unique=False,
)
op.create_index(
"af_staked_fbtc_current_wallet_block_desc_index",
"af_staked_fbtc_current",
[sa.text("wallet_address DESC")],
unique=False,
)
op.create_table('af_merchant_moe_pool_data_hist',
sa.Column('pool_address', postgresql.BYTEA(), nullable=False),
sa.Column('block_timestamp', sa.BIGINT(), nullable=False),
sa.Column('block_number', sa.BIGINT(), nullable=False),
sa.Column('active_id', sa.BIGINT(), nullable=True),
sa.Column('bin_step', sa.BIGINT(), nullable=True),
sa.Column('create_time', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
sa.Column('update_time', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
sa.Column('reorg', sa.BOOLEAN(), nullable=True),
sa.PrimaryKeyConstraint('pool_address', 'block_timestamp', 'block_number')
op.create_table(
"af_staked_fbtc_detail_hist",
sa.Column("vault_address", postgresql.BYTEA(), nullable=False),
sa.Column("wallet_address", postgresql.BYTEA(), nullable=False),
sa.Column("block_number", sa.BIGINT(), nullable=False),
sa.Column("block_timestamp", sa.BIGINT(), nullable=False),
sa.Column("amount", sa.NUMERIC(precision=100), nullable=True),
sa.Column("changed_amount", sa.NUMERIC(precision=100), nullable=True),
sa.Column("protocol_id", sa.VARCHAR(), nullable=True),
sa.Column("create_time", postgresql.TIMESTAMP(), server_default=sa.text("now()"), nullable=True),
sa.Column("update_time", postgresql.TIMESTAMP(), server_default=sa.text("now()"), nullable=True),
sa.Column("reorg", sa.BOOLEAN(), nullable=True),
sa.PrimaryKeyConstraint("vault_address", "wallet_address", "block_timestamp", "block_number"),
)
op.create_table('af_staked_fbtc_current',
sa.Column('vault_address', postgresql.BYTEA(), nullable=False),
sa.Column('wallet_address', postgresql.BYTEA(), nullable=False),
sa.Column('block_number', sa.BIGINT(), nullable=True),
sa.Column('block_timestamp', sa.BIGINT(), nullable=True),
sa.Column('amount', sa.NUMERIC(precision=100), nullable=True),
sa.Column('changed_amount', sa.NUMERIC(precision=100), nullable=True),
sa.Column('protocol_id', sa.VARCHAR(), nullable=True),
sa.Column('create_time', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
sa.Column('update_time', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
sa.PrimaryKeyConstraint('vault_address', 'wallet_address')
op.create_index(
"af_staked_fbtc_detail_hist_protocol_block_desc_index",
"af_staked_fbtc_detail_hist",
[sa.text("protocol_id DESC"), sa.text("block_timestamp DESC")],
unique=False,
)
op.create_index('af_staked_fbtc_current_protocol_block_desc_index', 'af_staked_fbtc_current', [sa.text('protocol_id DESC')], unique=False)
op.create_index('af_staked_fbtc_current_wallet_block_desc_index', 'af_staked_fbtc_current', [sa.text('wallet_address DESC')], unique=False)
op.create_table('af_staked_fbtc_detail_hist',
sa.Column('vault_address', postgresql.BYTEA(), nullable=False),
sa.Column('wallet_address', postgresql.BYTEA(), nullable=False),
sa.Column('block_number', sa.BIGINT(), nullable=False),
sa.Column('block_timestamp', sa.BIGINT(), nullable=False),
sa.Column('amount', sa.NUMERIC(precision=100), nullable=True),
sa.Column('changed_amount', sa.NUMERIC(precision=100), nullable=True),
sa.Column('protocol_id', sa.VARCHAR(), nullable=True),
sa.Column('create_time', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
sa.Column('update_time', postgresql.TIMESTAMP(), server_default=sa.text('now()'), nullable=True),
sa.Column('reorg', sa.BOOLEAN(), nullable=True),
sa.PrimaryKeyConstraint('vault_address', 'wallet_address', 'block_timestamp', 'block_number')
op.create_index(
"af_staked_fbtc_detail_hist_wallet_block_desc_index",
"af_staked_fbtc_detail_hist",
[sa.text("wallet_address DESC"), sa.text("block_timestamp DESC")],
unique=False,
)
op.create_index('af_staked_fbtc_detail_hist_protocol_block_desc_index', 'af_staked_fbtc_detail_hist', [sa.text('protocol_id DESC'), sa.text('block_timestamp DESC')], unique=False)
op.create_index('af_staked_fbtc_detail_hist_wallet_block_desc_index', 'af_staked_fbtc_detail_hist', [sa.text('wallet_address DESC'), sa.text('block_timestamp DESC')], unique=False)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('af_staked_fbtc_detail_hist_wallet_block_desc_index', table_name='af_staked_fbtc_detail_hist')
op.drop_index('af_staked_fbtc_detail_hist_protocol_block_desc_index', table_name='af_staked_fbtc_detail_hist')
op.drop_table('af_staked_fbtc_detail_hist')
op.drop_index('af_staked_fbtc_current_wallet_block_desc_index', table_name='af_staked_fbtc_current')
op.drop_index('af_staked_fbtc_current_protocol_block_desc_index', table_name='af_staked_fbtc_current')
op.drop_table('af_staked_fbtc_current')
op.drop_table('af_merchant_moe_pool_data_hist')
op.drop_table('af_merchant_moe_pool_data_current')
op.drop_index("af_staked_fbtc_detail_hist_wallet_block_desc_index", table_name="af_staked_fbtc_detail_hist")
op.drop_index("af_staked_fbtc_detail_hist_protocol_block_desc_index", table_name="af_staked_fbtc_detail_hist")
op.drop_table("af_staked_fbtc_detail_hist")
op.drop_index("af_staked_fbtc_current_wallet_block_desc_index", table_name="af_staked_fbtc_current")
op.drop_index("af_staked_fbtc_current_protocol_block_desc_index", table_name="af_staked_fbtc_current")
op.drop_table("af_staked_fbtc_current")
op.drop_table("af_merchant_moe_pool_data_hist")
op.drop_table("af_merchant_moe_pool_data_current")
# ### end Alembic commands ###

0 comments on commit f0ab857

Please sign in to comment.