"""update doctag foreign keys

Revision ID: b32856085022
Revises: ae1528da307c
Create Date: 2018-12-06 13:17:57.678267

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "b32856085022"
down_revision = "ae1528da307c"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "doc_tag", type_="foreignkey")
    op.drop_constraint(None, "doc_tag", type_="foreignkey")
    op.create_foreign_key(None, "doc_tag", "doc", ["doc_id"], ["id"])
    op.create_foreign_key(None, "doc_tag", "tag", ["tag_id"], ["id"])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "doc_tag", type_="foreignkey")
    op.drop_constraint(None, "doc_tag", type_="foreignkey")
    op.create_foreign_key(None, "doc_tag", "tag", ["tag_id"], ["id"], ondelete="CASCADE")
    op.create_foreign_key(None, "doc_tag", "doc", ["doc_id"], ["id"], ondelete="CASCADE")
    # ### end Alembic commands ###
