"""updated settings

Peek Plugin Database Migration Script

Revision ID: 7e3f668edf0e
Revises: 2209cf338e6d
Create Date: 2019-08-03 20:20:32.348282

"""

# revision identifiers, used by Alembic.
revision = '7e3f668edf0e'
down_revision = '2209cf338e6d'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
import geoalchemy2


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('UserLoggedIn', sa.Column('isFieldLogin', sa.Boolean(), nullable=True), schema='core_user')
    # ### end Alembic commands ###

    op.execute('''
    DELETE FROM core_user."SettingProperty"
    WHERE "key" = 'Allow Multi Device Logins'
    ''')

    op.execute('''
    UPDATE core_user."SettingProperty"
    SET "key" = 'Field Show Login as List'
    WHERE "key" = 'Show Login as List'
    ''')

    op.execute('''
    UPDATE core_user."SettingProperty"
    SET "key" = 'Field Show Vehicle Input'
    WHERE "key" = 'Show Vehicle Input'
    ''')


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('UserLoggedIn', 'isFieldLogin', schema='core_user')
    # ### end Alembic commands ###
