# -*- coding: utf-8 -*-

from ppms.migration import SQLPacket, PacketCategory, MaxVersionDependency, VersionType
from ppms import ppms

class ChangeListboxSecondarySymbolID(SQLPacket):
    '''Changing DI 026621 "Sekundäre Symbol-ID" from OLE-Listbox to Symbol-Listbox 009AJC'''
    wi_number = 21037
    done_after_success = True  
    run_on_startup = True  
    category = PacketCategory.CATEGORY_MANDATORY  

    UPDATE_MESSAGE = """Update DT411 set DI000111='009AJC', DI003703 ='350' WHERE DI000306='000397' AND DI000307='104750' """

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

    def fix(self, runner):
        try:
            self.modify_and_log(self.UPDATE_MESSAGE)
            return self.success()
        except ppms.DatabaseError:
            self.log("Error: Could not update Column")
            return self.fail()