# -*- coding: utf-8 -*-
from ppms import ppms
from ppms.migration.packet import *
from ppms.migration import PacketCategory, MaxVersionDependency, VersionType

QUERYTOSENDDI = """UPDATE DT412 SET DI027172=1 WHERE DI000238='001955'"""
QUERYTOSETDITONULL = """UPDATE DT424 SET DI001955 = 0"""

class MakeSymbolMinWidthServerRelevant(SQLPacket):
    '''Necessary to serialize symbol min width to client'''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 20938

    def get_dependencies(self):
        return (MaxVersionDependency(version='39.5.10', version_type=VersionType.CUSTOMIZING))

    def fix(self, runner):
        ppms.db_modify(QUERYTOSENDDI)
        ppms.db_modify(QUERYTOSETDITONULL)

        return self.success()
