From 16f8402ebf6d3fe8838d056cc70dffa69c49ef18 Mon Sep 17 00:00:00 2001 From: MooreTheAnalyst <162017070+MooreTheAnalyst@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:12:21 +0000 Subject: [PATCH] Migration command fix --- .../c53651eb145e_add_new_events_models.py | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 apps/data_handler/migrations/versions/c53651eb145e_add_new_events_models.py diff --git a/apps/data_handler/migrations/versions/c53651eb145e_add_new_events_models.py b/apps/data_handler/migrations/versions/c53651eb145e_add_new_events_models.py new file mode 100644 index 00000000..7b326f8f --- /dev/null +++ b/apps/data_handler/migrations/versions/c53651eb145e_add_new_events_models.py @@ -0,0 +1,85 @@ +"""add-new-events-models + +Revision ID: c53651eb145e +Revises: 163f616930fb +Create Date: 2024-11-27 17:27:03.992425 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = 'c53651eb145e' +down_revision: Union[str, None] = '163f616930fb' +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.drop_index('ix_debt_mint_event_block_number', table_name='debt_mint_event') + op.drop_index('ix_debt_mint_event_event_name', table_name='debt_mint_event') + op.drop_table('debt_mint_event') + op.drop_index('ix_debt_burn_event_block_number', table_name='debt_burn_event') + op.drop_index('ix_debt_burn_event_event_name', table_name='debt_burn_event') + op.drop_table('debt_burn_event') + op.drop_index('ix_debt_transfer_event_block_number', table_name='debt_transfer_event') + op.drop_index('ix_debt_transfer_event_event_name', table_name='debt_transfer_event') + op.drop_table('debt_transfer_event') + op.drop_index('ix_bearing_collateral_burn_event_block_number', table_name='bearing_collateral_burn_event') + op.drop_index('ix_bearing_collateral_burn_event_event_name', table_name='bearing_collateral_burn_event') + op.drop_table('bearing_collateral_burn_event') + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('bearing_collateral_burn_event', + sa.Column('user', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('amount', sa.NUMERIC(precision=38, scale=18), autoincrement=False, nullable=False), + sa.Column('event_name', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('block_number', sa.INTEGER(), autoincrement=False, nullable=False), + sa.Column('protocol_id', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('id', sa.UUID(), autoincrement=False, nullable=False), + sa.PrimaryKeyConstraint('id', name='bearing_collateral_burn_event_pkey') + ) + op.create_index('ix_bearing_collateral_burn_event_event_name', 'bearing_collateral_burn_event', ['event_name'], unique=False) + op.create_index('ix_bearing_collateral_burn_event_block_number', 'bearing_collateral_burn_event', ['block_number'], unique=False) + op.create_table('debt_transfer_event', + sa.Column('sender', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('recipient', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('amount', sa.NUMERIC(precision=38, scale=18), autoincrement=False, nullable=False), + sa.Column('event_name', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('block_number', sa.INTEGER(), autoincrement=False, nullable=False), + sa.Column('protocol_id', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('id', sa.UUID(), autoincrement=False, nullable=False), + sa.PrimaryKeyConstraint('id', name='debt_transfer_event_pkey') + ) + op.create_index('ix_debt_transfer_event_event_name', 'debt_transfer_event', ['event_name'], unique=False) + op.create_index('ix_debt_transfer_event_block_number', 'debt_transfer_event', ['block_number'], unique=False) + op.create_table('debt_burn_event', + sa.Column('user', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('amount', sa.NUMERIC(precision=38, scale=18), autoincrement=False, nullable=False), + sa.Column('event_name', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('block_number', sa.INTEGER(), autoincrement=False, nullable=False), + sa.Column('protocol_id', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('id', sa.UUID(), autoincrement=False, nullable=False), + sa.PrimaryKeyConstraint('id', name='debt_burn_event_pkey') + ) + op.create_index('ix_debt_burn_event_event_name', 'debt_burn_event', ['event_name'], unique=False) + op.create_index('ix_debt_burn_event_block_number', 'debt_burn_event', ['block_number'], unique=False) + op.create_table('debt_mint_event', + sa.Column('user', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('amount', sa.NUMERIC(precision=38, scale=18), autoincrement=False, nullable=False), + sa.Column('event_name', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('block_number', sa.INTEGER(), autoincrement=False, nullable=False), + sa.Column('protocol_id', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('id', sa.UUID(), autoincrement=False, nullable=False), + sa.PrimaryKeyConstraint('id', name='debt_mint_event_pkey') + ) + op.create_index('ix_debt_mint_event_event_name', 'debt_mint_event', ['event_name'], unique=False) + op.create_index('ix_debt_mint_event_block_number', 'debt_mint_event', ['block_number'], unique=False) + # ### end Alembic commands ###