"""change useragent sip info

Revision ID: 33190b4b4d21
Revises: 510c9ca41edf

"""

# revision identifiers, used by Alembic.
revision = "33190b4b4d21"
down_revision = "510c9ca41edf"

import sqlalchemy as sa
from sqlalchemy import sql

from alembic import op

staticsip_table = sa.sql.table(
    "staticsip", sql.column("var_name"), sql.column("var_val")
)


def upgrade():
    op.execute(
        staticsip_table.update()
        .where(
            sa.sql.and_(
                staticsip_table.c.var_name == "useragent",
                staticsip_table.c.var_val == "XiVO PBX",
            )
        )
        .values(var_val="XIVO_VERSION")
    )


def downgrade():
    op.execute(
        staticsip_table.update()
        .where(
            sa.sql.and_(
                staticsip_table.c.var_name == "useragent",
                staticsip_table.c.var_val == "XIVO_VERSION",
            )
        )
        .values(var_val="XiVO PBX")
    )
