"""main migration

Revision ID: 4412a06d92fe
Revises: 
Create Date: 2020-07-04 14:38:49.452615

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4412a06d92fe'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('books_and_other_readings', sa.Column('cat_id', sa.Integer(), nullable=True))
    op.create_index(op.f('ix_books_and_other_readings_cat_id'), 'books_and_other_readings', ['cat_id'], unique=False)
    op.drop_index('ix_books_and_other_readings_title', table_name='books_and_other_readings')
    op.create_index(op.f('ix_books_and_other_readings_title'), 'books_and_other_readings', ['title'], unique=False)
    op.create_foreign_key(None, 'books_and_other_readings', 'categories', ['cat_id'], ['id'])
    op.add_column('public_posts', sa.Column('dislikes', sa.Integer(), nullable=True))
    op.add_column('public_posts', sa.Column('likes', sa.Integer(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('public_posts', 'likes')
    op.drop_column('public_posts', 'dislikes')
    op.drop_constraint(None, 'books_and_other_readings', type_='foreignkey')
    op.drop_index(op.f('ix_books_and_other_readings_title'), table_name='books_and_other_readings')
    op.create_index('ix_books_and_other_readings_title', 'books_and_other_readings', ['title'], unique=1)
    op.drop_index(op.f('ix_books_and_other_readings_cat_id'), table_name='books_and_other_readings')
    op.drop_column('books_and_other_readings', 'cat_id')
    # ### end Alembic commands ###
