"""empty message

Revision ID: 3c384c96c051
Revises: c95edecc5f4d
Create Date: 2020-01-26 12:22:30.376959

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '3c384c96c051'
down_revision = 'c95edecc5f4d'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('post', sa.Column('create_time', sa.DateTime(), nullable=True, comment='帖子创建时间'))
    op.add_column('post', sa.Column('pdf_id', mysql.BIGINT(unsigned=True), nullable=True, comment='帖子作者的用户ID'))
    op.add_column('post', sa.Column('update_time', sa.DateTime(), nullable=True, comment='更新时间'))
    op.create_index(op.f('ix_post_create_time'), 'post', ['create_time'], unique=False)
    op.drop_index('ix_post_timestamp', table_name='post')
    op.create_foreign_key(None, 'post', 'pdf', ['pdf_id'], ['id'])
    op.drop_column('post', 'language')
    op.drop_column('post', 'timestamp')
    op.drop_column('post', 'title')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('post', sa.Column('title', mysql.VARCHAR(length=200), nullable=True, comment='帖子标题'))
    op.add_column('post', sa.Column('timestamp', mysql.DATETIME(), nullable=True, comment='帖子创建时间'))
    op.add_column('post', sa.Column('language', mysql.VARCHAR(length=5), nullable=True, comment='语言'))
    op.drop_constraint(None, 'post', type_='foreignkey')
    op.create_index('ix_post_timestamp', 'post', ['timestamp'], unique=False)
    op.drop_index(op.f('ix_post_create_time'), table_name='post')
    op.drop_column('post', 'update_time')
    op.drop_column('post', 'pdf_id')
    op.drop_column('post', 'create_time')
    # ### end Alembic commands ###
