"""create event timezone field

Revision ID: 71158d29ff66
Revises: bf8eb5022084
Create Date: 2021-05-31 16:36:23.958691

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

# revision identifiers, used by Alembic.
revision = '71158d29ff66'
down_revision = 'bf8eb5022084'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('event_log', sa.Column('timezone', sa.String(), nullable=True))
    op.execute("UPDATE public.event_log SET timezone = 'US/Pacific'")  # on migration, everyone gets set to US/Pacific
    op.alter_column('event_log', "timezone", nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('event_log', 'timezone')
    # ### end Alembic commands ###
