"""add surname to AuthorModel.

Revision ID: f030412f4544
Revises: 01e8fe75c0a3
Create Date: 2021-03-04 14:13:18.407157

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'f030412f4544'
down_revision = '01e8fe75c0a3'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('author_model', schema=None) as batch_op:
        batch_op.add_column(sa.Column('surname', sa.String(length=32), nullable=True))
        batch_op.create_unique_constraint('surname', ['surname'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('author_model', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='unique')
        batch_op.drop_column('surname')

    # ### end Alembic commands ###
