"""Remove booksales tables

Revision ID: 2d257d93329
Revises: 3ee07cd6b53
Create Date: 2016-04-09 13:04:55.562530

"""

# revision identifiers, used by Alembic.
revision = '2d257d93329'
down_revision = '3ee07cd6b53'

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

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('booksales_sale_group')
    op.drop_table('booksales_book')
    op.drop_table('booksales_sale')
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('booksales_sale',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('created', mysql.DATETIME(), nullable=True),
    sa.Column('modified', mysql.DATETIME(), nullable=True),
    sa.Column('student_number', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('price', mysql.FLOAT(), nullable=True),
    sa.Column('payment', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='latin1',
    mysql_engine='InnoDB'
    )
    op.create_table('booksales_book',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('created', mysql.DATETIME(), nullable=True),
    sa.Column('modified', mysql.DATETIME(), nullable=True),
    sa.Column('title', mysql.TEXT(), nullable=True),
    sa.Column('price', mysql.FLOAT(), nullable=True),
    sa.Column('isbn', mysql.TEXT(), nullable=True),
    sa.Column('stock', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='latin1',
    mysql_engine='InnoDB'
    )

    op.create_table('booksales_sale_group',
    sa.Column('book_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('sale_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['book_id'], ['booksales_book.id'], name='booksales_sale_group_ibfk_1'),
    sa.ForeignKeyConstraint(['sale_id'], ['booksales_sale.id'], name='booksales_sale_group_ibfk_2'),
    mysql_default_charset='latin1',
    mysql_engine='InnoDB'
    )

    ### end Alembic commands ###
