# -*- coding: utf-8 -*-
from ppms.migration.packet import *

class FixDAName(SQLPacket):
    '''Delete sourceref of exit 00000066.

    Data area names in the module customizer showed the name of the data table instead, this should fix it.
    '''

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

    SQL = """UPDATE DT445 SET DI000099 = 0 WHERE DI000609 = '00000066' AND DI000099 != 0"""

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