"""

Revision ID: 0409_fix_service_name
Revises: 0408_fix_timezone_again
Create Date: 2023-12-13 11:38:01.314057

"""

from sqlalchemy import text

revision = "0409_fix_service_name"
down_revision = "0408_fix_timezone_again"

from alembic import op
from flask import current_app

service_id = current_app.config["NOTIFY_SERVICE_ID"]


def upgrade():
    conn = op.get_bind()

    # modify name of default service user in services
    # table_name = 'services'
    # col = 'name'
    # val = 'Notify.gov'
    # select_by_col = 'id'
    # select_by_val = service_id
    input_params = {"service_id": service_id}
    conn.execute(
        text("update services set name='Notify.gov' where id =:service_id"),
        input_params,
    )

    # table_name = 'services_history'
    conn.execute(
        text("update services_history set name='Notify.gov' where id =:service_id"),
        input_params,
    )


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###
