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


class PortPlaceholderCheckbox(SQLPacket):
    """Port DI 063594 that shows if the placeholder in DT 499 is set"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 14325

    FILENAME = 'wi14325_placeholder_checkbox.sql'
    DELETE_QUERY = 'DELETE FROM DT435 WHERE DI001538 = 804248'

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

    def fix(self, runner):
        self.modify_and_log(self.DELETE_QUERY)
        self.apply_dml_file(self.sql_planta_de_dbms, self.FILENAME)

        return self.success()