"""index table

Revision ID: dbbe793e230a
Revises: 
Create Date: 2021-01-21 20:53:21.840269

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('author',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=20), nullable=True),
    sa.Column('surname', sa.String(length=20), nullable=True),
    sa.Column('birth', sa.String(length=15), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_author_birth'), 'author', ['birth'], unique=False)
    op.create_index(op.f('ix_author_name'), 'author', ['name'], unique=False)
    op.create_index(op.f('ix_author_surname'), 'author', ['surname'], unique=False)
    op.create_table('book',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=20), nullable=True),
    sa.Column('genre', sa.String(length=15), nullable=True),
    sa.Column('pages', sa.Integer(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('stock', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['author.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_book_genre'), 'book', ['genre'], unique=False)
    op.create_index(op.f('ix_book_pages'), 'book', ['pages'], unique=False)
    op.create_index(op.f('ix_book_title'), 'book', ['title'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_book_title'), table_name='book')
    op.drop_index(op.f('ix_book_pages'), table_name='book')
    op.drop_index(op.f('ix_book_genre'), table_name='book')
    op.drop_table('book')
    op.drop_index(op.f('ix_author_surname'), table_name='author')
    op.drop_index(op.f('ix_author_name'), table_name='author')
    op.drop_index(op.f('ix_author_birth'), table_name='author')
    op.drop_table('author')
    # ### end Alembic commands ###
