"""Make post and topic hideable models

Revision ID: 331500ad355b
Revises:
Create Date: 2017-09-03 17:03:06.460391

"""
from alembic import op
import sqlalchemy as sa
from flaskbb.utils.database import UTCDateTime


# revision identifiers, used by Alembic.
revision = '331500ad355b'
down_revision = None
branch_labels = ('default',)
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('posts', schema=None) as batch_op:
        batch_op.add_column(sa.Column('hidden', sa.Boolean(), nullable=True))
        batch_op.add_column(sa.Column('hidden_at', UTCDateTime(timezone=True), nullable=True))

    with op.batch_alter_table('topics', schema=None) as batch_op:
        batch_op.add_column(sa.Column('hidden', sa.Boolean(), nullable=True))
        batch_op.add_column(sa.Column('hidden_at', UTCDateTime(timezone=True), nullable=True))

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('topics', schema=None) as batch_op:
        batch_op.drop_column('hidden_at')
        batch_op.drop_column('hidden')

    with op.batch_alter_table('posts', schema=None) as batch_op:
        batch_op.drop_column('hidden_at')
        batch_op.drop_column('hidden')

    # ### end Alembic commands ###