text: """baseline
  
  Revision ID: 4f628b3f93ef
  Revises: 
  Create Date: 2022-04-07 09:32:52.832717
  
  """
  from alembic import op
  import sqlalchemy as sa
  
  
  # revision identifiers, used by Alembic.
  revision = '4f628b3f93ef'
  down_revision = None
  branch_labels = None
  depends_on = None
  
  
  def upgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.create_table('blockchain',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('name', sa.VARCHAR(length=50), nullable=False),
      sa.Column('description', sa.TEXT(), nullable=False),
      sa.Column('symbol', sa.VARCHAR(length=30), nullable=False),
      sa.Column('logo', sa.VARCHAR(length=250), nullable=False),
      sa.Column('chain_id', sa.INTEGER(), nullable=False),
      sa.Column('block_confirmation', sa.INTEGER(), nullable=False),
      sa.Column('is_extension_available', sa.BOOLEAN(), nullable=True),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('id'),
      sa.UniqueConstraint('name', 'symbol')
      )
      op.create_table('message_group_pool',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('name', sa.VARCHAR(length=50), nullable=False),
      sa.Column('message_group_id', sa.VARCHAR(length=30), nullable=False),
      sa.Column('trigger_count', sa.BIGINT(), nullable=True),
      sa.Column('is_enabled', sa.BOOLEAN(), nullable=True),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('id'),
      sa.UniqueConstraint('message_group_id')
      )
      op.create_table('token',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('name', sa.VARCHAR(length=50), nullable=False),
      sa.Column('description', sa.TEXT(), nullable=False),
      sa.Column('symbol', sa.VARCHAR(length=30), nullable=False),
      sa.Column('logo', sa.VARCHAR(length=250), nullable=True),
      sa.Column('blockchain_id', sa.BIGINT(), nullable=False),
      sa.Column('allowed_decimal', sa.INTEGER(), nullable=True),
      sa.Column('token_address', sa.VARCHAR(length=100), nullable=False),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.ForeignKeyConstraint(['blockchain_id'], ['blockchain.row_id'], ),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('id'),
      sa.UniqueConstraint('name', 'symbol', 'blockchain_id')
      )
      op.create_table('conversion_fee',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('percentage_from_source', sa.DECIMAL(precision=10, scale=5), nullable=False),
      sa.Column('amount', sa.DECIMAL(precision=64, scale=0), nullable=True),
      sa.Column('token_id', sa.BIGINT(), nullable=True),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.ForeignKeyConstraint(['token_id'], ['token.row_id'], ),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('id')
      )
      op.create_table('token_pair',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('from_token_id', sa.BIGINT(), nullable=False),
      sa.Column('to_token_id', sa.BIGINT(), nullable=False),
      sa.Column('conversion_fee_id', sa.BIGINT(), nullable=True),
      sa.Column('is_enabled', sa.BOOLEAN(), nullable=True),
      sa.Column('min_value', sa.DECIMAL(precision=64, scale=0), nullable=True),
      sa.Column('max_value', sa.DECIMAL(precision=64, scale=0), nullable=True),
      sa.Column('contract_address', sa.VARCHAR(length=250), nullable=False),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.ForeignKeyConstraint(['conversion_fee_id'], ['conversion_fee.row_id'], ),
      sa.ForeignKeyConstraint(['from_token_id'], ['token.row_id'], ),
      sa.ForeignKeyConstraint(['to_token_id'], ['token.row_id'], ),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('from_token_id', 'to_token_id'),
      sa.UniqueConstraint('id')
      )
      op.create_table('wallet_pair',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('token_pair_id', sa.BIGINT(), nullable=False),
      sa.Column('from_address', sa.VARCHAR(length=250), nullable=False),
      sa.Column('to_address', sa.VARCHAR(length=250), nullable=False),
      sa.Column('deposit_address', sa.VARCHAR(length=250), nullable=True),
      sa.Column('deposit_address_detail', sa.JSON(), nullable=True),
      sa.Column('signature', sa.VARCHAR(length=250), nullable=False),
      sa.Column('signature_metadata', sa.JSON(), nullable=False),
      sa.Column('signature_expiry', sa.TIMESTAMP(), nullable=True),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.ForeignKeyConstraint(['token_pair_id'], ['token_pair.row_id'], ),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('deposit_address'),
      sa.UniqueConstraint('id'),
      sa.UniqueConstraint('token_pair_id', 'from_address', 'to_address')
      )
      op.create_table('conversion',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('wallet_pair_id', sa.BIGINT(), nullable=False),
      sa.Column('deposit_amount', sa.DECIMAL(precision=64, scale=0), nullable=False),
      sa.Column('claim_amount', sa.DECIMAL(precision=64, scale=0), nullable=False),
      sa.Column('fee_amount', sa.DECIMAL(precision=64, scale=0), nullable=False),
      sa.Column('status', sa.VARCHAR(length=30), nullable=False),
      sa.Column('claim_signature', sa.VARCHAR(length=250), nullable=True),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.ForeignKeyConstraint(['wallet_pair_id'], ['wallet_pair.row_id'], ),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('id')
      )
      op.create_table('conversion_transaction',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('conversion_id', sa.BIGINT(), nullable=False),
      sa.Column('status', sa.VARCHAR(length=30), nullable=True),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.ForeignKeyConstraint(['conversion_id'], ['conversion.row_id'], ),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('id')
      )
      op.create_table('transaction',
      sa.Column('row_id', sa.BIGINT(), autoincrement=True, nullable=False),
      sa.Column('id', sa.VARCHAR(length=50), nullable=False),
      sa.Column('conversion_transaction_id', sa.BIGINT(), nullable=False),
      sa.Column('token_id', sa.BIGINT(), nullable=False),
      sa.Column('transaction_visibility', sa.VARCHAR(length=30), nullable=True),
      sa.Column('transaction_operation', sa.VARCHAR(length=30), nullable=True),
      sa.Column('transaction_hash', sa.VARCHAR(length=250), nullable=True),
      sa.Column('transaction_amount', sa.DECIMAL(precision=50, scale=20), nullable=True),
      sa.Column('confirmation', sa.INTEGER(), nullable=False),
      sa.Column('status', sa.VARCHAR(length=30), nullable=True),
      sa.Column('created_by', sa.VARCHAR(length=50), nullable=False),
      sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
      sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
      sa.ForeignKeyConstraint(['conversion_transaction_id'], ['conversion_transaction.row_id'], ),
      sa.ForeignKeyConstraint(['token_id'], ['token.row_id'], ),
      sa.PrimaryKeyConstraint('row_id'),
      sa.UniqueConstraint('id')
      )
      # ### end Alembic commands ###
  
  
  def downgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.drop_table('transaction')
      op.drop_table('conversion_transaction')
      op.drop_table('conversion')
      op.drop_table('wallet_pair')
      op.drop_table('token_pair')
      op.drop_table('conversion_fee')
      op.drop_table('token')
      op.drop_table('message_group_pool')
      op.drop_table('blockchain')
      # ### end Alembic commands ###
  