"""empty message

Revision ID: 3cffc5184734
Revises: 1215fe126a8a
Create Date: 2017-03-15 00:23:34.271146

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '3cffc5184734'
down_revision = '1215fe126a8a'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('images',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('image', sa.String(length=80), nullable=False),
    sa.Column('caption', sa.String(length=80), nullable=True),
    sa.Column('is_primary', sa.Boolean(), nullable=True),
    sa.Column('item_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['item_id'], ['items.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('reviews',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('stars', sa.Integer(), nullable=False),
    sa.Column('comment', sa.String(length=255), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('item_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['item_id'], ['items.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('items', sa.Column('created_at', sa.DateTime(), nullable=True))
    op.add_column('items', sa.Column('is_active', sa.Boolean(), nullable=True))
    op.add_column('items', sa.Column('price', sa.String(length=80), nullable=True))
    op.add_column('items', sa.Column('terms', sa.String(length=255), nullable=True))
    op.alter_column('items', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('items', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.drop_column('items', 'terms')
    op.drop_column('items', 'price')
    op.drop_column('items', 'is_active')
    op.drop_column('items', 'created_at')
    op.drop_table('reviews')
    op.drop_table('images')
    # ### end Alembic commands ###
