complete trigger rework; update SwapOrderStatus with Andrew's changes; not fully debugged

This commit is contained in:
tim
2024-08-25 19:21:05 -04:00
parent f1492d9326
commit 750b4bcd65
31 changed files with 1051 additions and 760 deletions

View File

@@ -72,7 +72,7 @@ def upgrade() -> None:
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('chain', dexorder.database.column_types.Blockchain(), nullable=False),
sa.Column('height', sa.Integer(), nullable=False),
sa.Column('state', sa.Enum('Requested', 'Signed', 'Sent', 'Mined', name='transactionjobstate'), nullable=False),
sa.Column('state', sa.Enum('Requested', 'Signed', 'Sent', 'Mined', 'Error', name='transactionjobstate'), nullable=False),
sa.Column('request', dexorder.database.column_types.DataclassDictBase(astext_type=sa.Text()), nullable=False),
sa.Column('tx_id', postgresql.BYTEA(), nullable=True),
sa.Column('tx_data', postgresql.BYTEA(), nullable=True),
@@ -83,10 +83,24 @@ def upgrade() -> None:
op.create_index(op.f('ix_transactionjob_height'), 'transactionjob', ['height'], unique=False)
op.create_index(op.f('ix_transactionjob_state'), 'transactionjob', ['state'], unique=False)
op.create_index(op.f('ix_transactionjob_tx_id'), 'transactionjob', ['tx_id'], unique=False)
# ### end Alembic commands ###
op.create_table('dbblock',
sa.Column('chain', dexorder.database.column_types.Blockchain(), nullable=False),
sa.Column('hash', postgresql.BYTEA(), nullable=False),
sa.Column('height', sa.Integer(), nullable=False),
sa.Column('timestamp', sa.INTEGER(), nullable=False),
sa.Column('confirmed', sa.Boolean(), nullable=False),
sa.Column('data', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
sa.PrimaryKeyConstraint('chain', 'hash')
)
op.create_index(op.f('ix_dbblock_height'), 'dbblock', ['height'], unique=False)
op.create_index(op.f('ix_dbblock_timestamp'), 'dbblock', ['timestamp'], unique=False)
def downgrade() -> None:
op.drop_index(op.f('ix_dbblock_timestamp'), table_name='dbblock')
op.drop_index(op.f('ix_dbblock_height'), table_name='dbblock')
op.drop_table('dbblock')
op.drop_index(op.f('ix_transactionjob_tx_id'), table_name='transactionjob')
op.drop_index(op.f('ix_transactionjob_state'), table_name='transactionjob')
op.drop_index(op.f('ix_transactionjob_height'), table_name='transactionjob')

View File

@@ -1,44 +0,0 @@
"""BlockIndex
Revision ID: ee22683693a5
Revises: 516b55c83144
Create Date: 2024-07-19 18:52:04.933167
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import dexorder.database
import dexorder.database.column_types
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = 'ee22683693a5'
down_revision: Union[str, None] = '516b55c83144'
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('dbblock',
sa.Column('chain', dexorder.database.column_types.Blockchain(), nullable=False),
sa.Column('hash', postgresql.BYTEA(), nullable=False),
sa.Column('height', sa.Integer(), nullable=False),
sa.Column('timestamp', sa.INTEGER(), nullable=False),
sa.Column('confirmed', sa.Boolean(), nullable=False),
sa.Column('data', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
sa.PrimaryKeyConstraint('chain', 'hash')
)
op.create_index(op.f('ix_dbblock_height'), 'dbblock', ['height'], unique=False)
op.create_index(op.f('ix_dbblock_timestamp'), 'dbblock', ['timestamp'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_dbblock_timestamp'), table_name='dbblock')
op.drop_index(op.f('ix_dbblock_height'), table_name='dbblock')
op.drop_table('dbblock')
# ### end Alembic commands ###