
# revision identifiers, used by Alembic.
revision = '0003_create_tokens'
down_revision = '0001_initialise_data'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tokens',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('token', sa.String(length=255), nullable=False),
    sa.Column('service_id', sa.Integer(), nullable=False),
    sa.Column('expiry_date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('token')
    )
    op.create_index(op.f('ix_tokens_service_id'), 'tokens', ['service_id'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_tokens_service_id'), table_name='tokens')
    op.drop_table('tokens')
    ### end Alembic commands ###


# revision identifiers, used by Alembic.
revision = '0003_create_tokens'
down_revision = '0002_add_templates'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tokens',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('token', sa.String(length=255), nullable=False),
    sa.Column('service_id', sa.Integer(), nullable=False),
    sa.Column('expiry_date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('token')
    )
    op.create_index(op.f('ix_tokens_service_id'), 'tokens', ['service_id'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_tokens_service_id'), table_name='tokens')
    op.drop_table('tokens')
    ### end Alembic commands ###

Fix the migration script so that the down revision is pointing to the migration scripts in the merge
Fix the migration script so that the down revision is pointing to the migration scripts in the merge

  
  # revision identifiers, used by Alembic.
  revision = '0003_create_tokens'
- down_revision = '0001_initialise_data'
+ down_revision = '0002_add_templates'
  
  from alembic import op
  import sqlalchemy as sa
  
  
  def upgrade():
      ### commands auto generated by Alembic - please adjust! ###
      op.create_table('tokens',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('token', sa.String(length=255), nullable=False),
      sa.Column('service_id', sa.Integer(), nullable=False),
      sa.Column('expiry_date', sa.DateTime(), nullable=True),
      sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('token')
      )
      op.create_index(op.f('ix_tokens_service_id'), 'tokens', ['service_id'], unique=False)
      ### end Alembic commands ###
  
  
  def downgrade():
      ### commands auto generated by Alembic - please adjust! ###
      op.drop_index(op.f('ix_tokens_service_id'), table_name='tokens')
      op.drop_table('tokens')
      ### end Alembic commands ###
  
Fix the migration script so that the down revision is pointing to the migration scripts in the merge
## Code Before:

# revision identifiers, used by Alembic.
revision = '0003_create_tokens'
down_revision = '0001_initialise_data'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tokens',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('token', sa.String(length=255), nullable=False),
    sa.Column('service_id', sa.Integer(), nullable=False),
    sa.Column('expiry_date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('token')
    )
    op.create_index(op.f('ix_tokens_service_id'), 'tokens', ['service_id'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_tokens_service_id'), table_name='tokens')
    op.drop_table('tokens')
    ### end Alembic commands ###

## Instruction:
Fix the migration script so that the down revision is pointing to the migration scripts in the merge
## Code After:

# revision identifiers, used by Alembic.
revision = '0003_create_tokens'
down_revision = '0002_add_templates'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tokens',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('token', sa.String(length=255), nullable=False),
    sa.Column('service_id', sa.Integer(), nullable=False),
    sa.Column('expiry_date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('token')
    )
    op.create_index(op.f('ix_tokens_service_id'), 'tokens', ['service_id'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_tokens_service_id'), table_name='tokens')
    op.drop_table('tokens')
    ### end Alembic commands ###
