
# revision identifiers, used by Alembic.
revision = '307a4fbe8a05'
down_revision = 'd6b40a745e5'

from alembic import op


def upgrade():
    try:
        op.create_index(op.f('ix_challenge_serial'), 'challenge', ['serial'],
                        unique=False)
    except Exception as exx:
        print("Could not add index to 'challenge.serial'")
        print (exx)
    try:
        op.drop_index('ix_challenge_transaction_id', table_name='challenge')
        op.create_index(op.f('ix_challenge_transaction_id'), 'challenge',
                        ['transaction_id'], unique=False)
    except Exception as exx:
        print("Could not remove uniqueness from 'challenge.transaction_id'")
        print (exx)


def downgrade():
    op.drop_index(op.f('ix_challenge_transaction_id'), table_name='challenge')
    op.create_index('ix_challenge_transaction_id', 'challenge',
                    ['transaction_id'], unique=1)
    op.drop_index(op.f('ix_challenge_serial'), table_name='challenge')


# revision identifiers, used by Alembic.
revision = '307a4fbe8a05'
down_revision = '1edda52b619f'

from alembic import op


def upgrade():
    try:
        op.create_index(op.f('ix_challenge_serial'), 'challenge', ['serial'],
                        unique=False)
    except Exception as exx:
        print("Could not add index to 'challenge.serial'")
        print (exx)
    try:
        op.drop_index('ix_challenge_transaction_id', table_name='challenge')
        op.create_index(op.f('ix_challenge_transaction_id'), 'challenge',
                        ['transaction_id'], unique=False)
    except Exception as exx:
        print("Could not remove uniqueness from 'challenge.transaction_id'")
        print (exx)


def downgrade():
    op.drop_index(op.f('ix_challenge_transaction_id'), table_name='challenge')
    op.create_index('ix_challenge_transaction_id', 'challenge',
                    ['transaction_id'], unique=1)
    op.drop_index(op.f('ix_challenge_serial'), table_name='challenge')

Fix history chain of DB migrations.
Fix history chain of DB migrations.

  
  # revision identifiers, used by Alembic.
  revision = '307a4fbe8a05'
- down_revision = 'd6b40a745e5'
+ down_revision = '1edda52b619f'
  
  from alembic import op
  
  
  def upgrade():
      try:
          op.create_index(op.f('ix_challenge_serial'), 'challenge', ['serial'],
                          unique=False)
      except Exception as exx:
          print("Could not add index to 'challenge.serial'")
          print (exx)
      try:
          op.drop_index('ix_challenge_transaction_id', table_name='challenge')
          op.create_index(op.f('ix_challenge_transaction_id'), 'challenge',
                          ['transaction_id'], unique=False)
      except Exception as exx:
          print("Could not remove uniqueness from 'challenge.transaction_id'")
          print (exx)
  
  
  def downgrade():
      op.drop_index(op.f('ix_challenge_transaction_id'), table_name='challenge')
      op.create_index('ix_challenge_transaction_id', 'challenge',
                      ['transaction_id'], unique=1)
      op.drop_index(op.f('ix_challenge_serial'), table_name='challenge')
  
Fix history chain of DB migrations.
## Code Before:

# revision identifiers, used by Alembic.
revision = '307a4fbe8a05'
down_revision = 'd6b40a745e5'

from alembic import op


def upgrade():
    try:
        op.create_index(op.f('ix_challenge_serial'), 'challenge', ['serial'],
                        unique=False)
    except Exception as exx:
        print("Could not add index to 'challenge.serial'")
        print (exx)
    try:
        op.drop_index('ix_challenge_transaction_id', table_name='challenge')
        op.create_index(op.f('ix_challenge_transaction_id'), 'challenge',
                        ['transaction_id'], unique=False)
    except Exception as exx:
        print("Could not remove uniqueness from 'challenge.transaction_id'")
        print (exx)


def downgrade():
    op.drop_index(op.f('ix_challenge_transaction_id'), table_name='challenge')
    op.create_index('ix_challenge_transaction_id', 'challenge',
                    ['transaction_id'], unique=1)
    op.drop_index(op.f('ix_challenge_serial'), table_name='challenge')

## Instruction:
Fix history chain of DB migrations.
## Code After:

# revision identifiers, used by Alembic.
revision = '307a4fbe8a05'
down_revision = '1edda52b619f'

from alembic import op


def upgrade():
    try:
        op.create_index(op.f('ix_challenge_serial'), 'challenge', ['serial'],
                        unique=False)
    except Exception as exx:
        print("Could not add index to 'challenge.serial'")
        print (exx)
    try:
        op.drop_index('ix_challenge_transaction_id', table_name='challenge')
        op.create_index(op.f('ix_challenge_transaction_id'), 'challenge',
                        ['transaction_id'], unique=False)
    except Exception as exx:
        print("Could not remove uniqueness from 'challenge.transaction_id'")
        print (exx)


def downgrade():
    op.drop_index(op.f('ix_challenge_transaction_id'), table_name='challenge')
    op.create_index('ix_challenge_transaction_id', 'challenge',
                    ['transaction_id'], unique=1)
    op.drop_index(op.f('ix_challenge_serial'), table_name='challenge')
