"""refined tables

Revision ID: f5c1b4b5edad
Revises: 
Create Date: 2019-11-20 01:39:58.789634

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password_bash', sa.String(length=128), nullable=True),
    sa.Column('about_me', sa.String(length=140), nullable=True),
    sa.Column('last_seen', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('post',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.String(length=140), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_post_timestamp'), 'post', ['timestamp'], unique=False)
    op.create_index(op.f('ix_review_overall'), 'review', ['overall'], unique=False)
    op.create_index(op.f('ix_review_reviewText'), 'review', ['reviewText'], unique=False)
    op.create_index(op.f('ix_review_summary'), 'review', ['summary'], unique=False)
    op.create_index(op.f('ix_review_unixReviewTime'), 'review', ['unixReviewTime'], unique=False)
    op.drop_index('ix_review_id', table_name='review')
    op.create_index(op.f('ix_reviewer_information_reviewerName'), 'reviewer_information', ['reviewerName'], unique=False)
    op.drop_index('ix_reviewer_information_id', table_name='reviewer_information')
    op.create_index(op.f('ix_reviewer_reviews_asin'), 'reviewer_reviews', ['asin'], unique=False)
    op.drop_index('ix_reviewer_reviews_id', table_name='reviewer_reviews')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index('ix_reviewer_reviews_id', 'reviewer_reviews', ['id'], unique=False)
    op.drop_index(op.f('ix_reviewer_reviews_asin'), table_name='reviewer_reviews')
    op.create_index('ix_reviewer_information_id', 'reviewer_information', ['id'], unique=False)
    op.drop_index(op.f('ix_reviewer_information_reviewerName'), table_name='reviewer_information')
    op.create_index('ix_review_id', 'review', ['id'], unique=False)
    op.drop_index(op.f('ix_review_unixReviewTime'), table_name='review')
    op.drop_index(op.f('ix_review_summary'), table_name='review')
    op.drop_index(op.f('ix_review_reviewText'), table_name='review')
    op.drop_index(op.f('ix_review_overall'), table_name='review')
    op.drop_index(op.f('ix_post_timestamp'), table_name='post')
    op.drop_table('post')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    # ### end Alembic commands ###
