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

class RemoveLoggingByUser(SQLPacket):
    """Remove "Logging by user" from logging work area"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 13643

    SQL = """DELETE FROM DT515 WHERE DI010325 = '01100108' AND DI010327 = '006627'"""

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

    def fix(self, runner):
        self.modify_and_log(self.SQL)
        return self.success()