"""added unique constraints on branch name and project

Revision ID: e404f52562c2
Revises: 42ea01a6cf31
Create Date: 2021-06-27 16:00:20.034147

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'e404f52562c2'
down_revision = '42ea01a6cf31'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index('ix_branches_name_project_id_not_deleted', 'branches', ['name', 'project_id'], unique=True, postgresql_where=sa.text('deleted IS NULL'))
    # ### end Alembic commands ###


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