"""Add a unique index to prevent deadlocks with tags.

Revision ID: 2b4dc0818a5e
Revises: 2b2529fd23ff
Create Date: 2015-03-20 23:37:10.558179

"""

# revision identifiers, used by Alembic.
revision = '2b4dc0818a5e'
down_revision = '2b2529fd23ff'

from alembic import op
import sqlalchemy as sa


def upgrade(tables):
    ### commands auto generated by Alembic - please adjust! ###
    op.create_index('repositorytag_repository_id_name_lifetime_end_ts', 'repositorytag', ['repository_id', 'name', 'lifetime_end_ts'], unique=True)
    ### end Alembic commands ###


def downgrade(tables):
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('repositorytag_repository_id_name_lifetime_end_ts', table_name='repositorytag')
    ### end Alembic commands ###
