"""tag_owner_should_be_tag_foreign_key_add_seperate_user_foreign_key

Revision ID: a7f8ce4c9061
Revises: cceef243c7e2
Create Date: 2020-03-07 22:05:35.827002

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a7f8ce4c9061'
down_revision = 'cceef243c7e2'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('tag', sa.Column('parent_id', sa.Integer(), nullable=True))
    op.drop_constraint('tag_owner_id_fkey', 'tag', type_='foreignkey')
    op.create_foreign_key(None, 'tag', 'tag', ['parent_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'tag', type_='foreignkey')
    op.create_foreign_key('tag_owner_id_fkey', 'tag', 'tag', ['owner_id'], ['id'])
    op.drop_column('tag', 'parent_id')
    # ### end Alembic commands ###
