"""empty message

Revision ID: 90bf669c739d
Revises: 87339cddaf50
Create Date: 2017-06-01 23:33:28.195623

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '90bf669c739d'
down_revision = '87339cddaf50'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('code', sa.Column('parent_link', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'code', 'code', ['parent_link'], ['id'])
    op.create_foreign_key(None, 'code', 'chat', ['chat_link'], ['id'])
    op.drop_column('code', 'parent')
    op.create_foreign_key(None, 'message', 'chat', ['chat_link'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'message', type_='foreignkey')
    op.add_column('code', sa.Column('parent', sa.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'code', type_='foreignkey')
    op.drop_constraint(None, 'code', type_='foreignkey')
    op.drop_column('code', 'parent_link')
    # ### end Alembic commands ###
