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


class DeactivateResubmissionInProject(SQLPacket):
    """
    Deactivates corrupt DI 000820
    """

    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 16252

    UPDATE_QUERY = """UPDATE DT412 SET ENABLED = 0 WHERE DI000238 = '000820'"""

    def get_dependencies(self):
        return (MinVersionDependency(version='39.4'),
                MaxVersionDependency(version='39.4'))

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