"""empty message

Revision ID: 391b24b33343
Revises: e4338c095afb
Create Date: 2021-06-24 16:47:10.434392

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '391b24b33343'
down_revision = 'e4338c095afb'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('post_id', sa.Integer(), nullable=False),
    sa.Column('body', sa.String(length=1000), nullable=False),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('post_reactions', sa.Column('reaction', sa.Boolean(), nullable=True))
    op.drop_constraint('post_reactions_post_id_fkey', 'post_reactions', type_='foreignkey')
    op.create_foreign_key(None, 'post_reactions', 'posts', ['post_id'], ['id'], ondelete='CASCADE')
    op.drop_column('post_reactions', '_reaction')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('post_reactions', sa.Column('_reaction', sa.BOOLEAN(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'post_reactions', type_='foreignkey')
    op.create_foreign_key('post_reactions_post_id_fkey', 'post_reactions', 'posts', ['post_id'], ['id'])
    op.drop_column('post_reactions', 'reaction')
    op.drop_table('comments')
    # ### end Alembic commands ###
