"""empty message

Revision ID: fae075ac3385
Revises: 9dbc68737f5b
Create Date: 2019-09-11 11:57:34.688840

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'fae075ac3385'
down_revision = '9dbc68737f5b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comment',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('text', sa.String(length=250), nullable=True),
    sa.Column('create_date', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('post_comments',
    sa.Column('comment_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['comment_id'], ['comment.id'], ),
    sa.ForeignKeyConstraint(['post_id'], ['post.id'], )
    )
    op.create_table('user_comments',
    sa.Column('comment_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['comment_id'], ['comment.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
    )
    op.drop_table('user__comment')
    op.drop_column('post', 'comment')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('post', sa.Column('comment', sa.VARCHAR(length=250), nullable=True))
    op.create_table('user__comment',
    sa.Column('user_id', sa.INTEGER(), nullable=False),
    sa.Column('post_id', sa.INTEGER(), nullable=True),
    sa.Column('create_date', sa.DATETIME(), nullable=True),
    sa.PrimaryKeyConstraint('user_id')
    )
    op.drop_table('user_comments')
    op.drop_table('post_comments')
    op.drop_table('comment')
    # ### end Alembic commands ###
