""" Adding banner header and type to submission window

Revision ID: 505f4b28d33d
Revises: de5e3fa1d2d2
Create Date: 2019-12-05 13:38:19.627635

"""

# revision identifiers, used by Alembic.
revision = '505f4b28d33d'
down_revision = 'de5e3fa1d2d2'
branch_labels = None
depends_on = None

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

def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('submission_window', sa.Column('banner_type', sa.Text(), nullable=True))
    op.add_column('submission_window', sa.Column('header', sa.Text(), nullable=True))
    op.execute("""
                UPDATE submission_window
                SET banner_type = 'warning'
            """)
    op.alter_column('submission_window', 'banner_type', nullable=False)
    # ### end Alembic commands ###


def downgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('submission_window', 'header')
    op.drop_column('submission_window', 'banner_type')
    # ### end Alembic commands ###

