"""Enlarge serial column in audit table

Revision ID: 49a04e560d96
Revises: 2118e566df16
Create Date: 2018-02-14 16:20:20.609200

"""

# revision identifiers, used by Alembic.
revision = "49a04e560d96"
down_revision = "2118e566df16"

import sqlalchemy as sa
from alembic import op


def upgrade():
    try:
        op.alter_column(
            "pidea_audit",
            "serial",
            existing_type=sa.VARCHAR(length=20),
            type_=sa.String(length=40),
            existing_nullable=True,
        )
    except Exception as exx:
        print("Could not enlarge column 'pidea_audit.serial'")
        print(exx)


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "pidea_audit",
        "serial",
        existing_type=sa.String(length=40),
        type_=sa.VARCHAR(length=20),
        existing_nullable=True,
    )
    ### end Alembic commands ###
