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

class FixOpPos(SQLPacket):
    '''Delete superfluous object protection position to avoid overwriting other values'''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 13399
    
    def get_dependencies(self):
        return (MinVersionDependency(version='39.5.2', version_type=VersionType.CUSTOMIZING),
                MaxVersionDependency(version='39.5.4', version_type=VersionType.CUSTOMIZING))

    def fix(self, runner):
        self.modify_and_log("UPDATE DT415 SET DI000928 = 0 where DI000265 IN ('324', '443')")
        return self.success()