"""Add file size

Revision ID: 1921a169739b
Revises: aa00db20c10a
Create Date: 2020-04-30 14:39:41.662130

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1921a169739b'
down_revision = 'aa00db20c10a'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('files', sa.Column('size', sa.INTEGER(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    # The following command won't work, see:
    # https://alembic.sqlalchemy.org/en/latest/batch.html
    # op.drop_column('files', 'size')
    # Therefore, we have to do:
    with op.batch_alter_table("files") as batch_op:
        batch_op.drop_column('size')

    # ### end Alembic commands ###
