"""add user preference to start elevation plots at zero

Revision ID: db58d195c5bf
Revises: 374a670efe23
Create Date: 2023-03-14 04:14:23.781672

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'db58d195c5bf'
down_revision = '374a670efe23'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('users', schema=None) as batch_op:
        batch_op.add_column(sa.Column('start_elevation_at_zero', sa.Boolean(), nullable=True))
    op.execute("UPDATE users SET start_elevation_at_zero = true")
    op.alter_column('users', 'start_elevation_at_zero', nullable=False)


    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('users', schema=None) as batch_op:
        batch_op.drop_column('start_elevation_at_zero')

    # ### end Alembic commands ###
