"""empty message

Revision ID: 189e7267d74d
Revises: 2691561059ac
Create Date: 2014-11-17 14:42:51.583261

"""

# revision identifiers, used by Alembic.
revision = '189e7267d74d'
down_revision = '2691561059ac'

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

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    # op.create_table('place_image',
    # sa.Column('id', sa.Integer(), nullable=False),
    # sa.Column('flickr_id', sa.BigInteger(), nullable=True),
    # sa.Column('place_id', sa.Integer(), nullable=True),
    # sa.Column('thumbnail_url', sa.Text(), nullable=True),
    # sa.Column('image_url', sa.Text(), nullable=True),
    # sa.Column('like_count', sa.Integer(), nullable=True),
    # sa.ForeignKeyConstraint(['place_id'], ['place.id'], onupdate='CASCADE', ondelete='CASCADE'),
    # sa.PrimaryKeyConstraint('id'),
    # sa.UniqueConstraint('flickr_id')
    # )
    # op.create_index(op.f('ix_place_image_like_count'), 'place_image', ['like_count'], unique=False)
    # op.create_table('image_like',
    # sa.Column('id', sa.Integer(), nullable=False),
    # sa.Column('user_id', sa.Integer(), nullable=True),
    # sa.Column('liked_time', sa.DateTime(), nullable=True),
    # sa.Column('place_image_id', sa.Integer(), nullable=True),
    # sa.ForeignKeyConstraint(['place_image_id'], ['place_image.id'], onupdate='CASCADE', ondelete='CASCADE'),
    # sa.ForeignKeyConstraint(['user_id'], ['user.id'], onupdate='CASCADE', ondelete='CASCADE'),
    # sa.PrimaryKeyConstraint('id'),
    # sa.UniqueConstraint('user_id', 'place_image_id', name='unq_image_like_uid_pid')
    # )
    op.drop_table('picture_like')
    op.drop_table('place_picture')
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('picture_like',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('user_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('liked_time', mysql.DATETIME(), nullable=True),
    sa.Column('place_picture_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['place_picture_id'], [u'place_picture.id'], name=u'picture_like_ibfk_1', onupdate=u'CASCADE', ondelete=u'CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'picture_like_ibfk_2', onupdate=u'CASCADE', ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('place_picture',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('thumbnail_url', mysql.TEXT(), nullable=True),
    sa.Column('image_url', mysql.TEXT(), nullable=True),
    sa.Column('like_count', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('flickr_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('place_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.drop_table('image_like')
    op.drop_index(op.f('ix_place_image_like_count'), table_name='place_image')
    op.drop_table('place_image')
    ### end Alembic commands ###
