"""Added post likes

Revision ID: 4913feafe780
Revises: d4f50aedad9e
Create Date: 2020-12-16 18:39:43.010089

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4913feafe780'
down_revision = 'd4f50aedad9e'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('post_likes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('post_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_column('post_images', 'caption')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('post_images', sa.Column('caption', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.drop_table('post_likes')
    # ### end Alembic commands ###
