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


class AddSapPspElements(SQLPacket):
    """Adds the new tables and columns for the SAP-PSP-Elements."""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 17601

    sql_script = 'WI17601_add_sap_psp_elements.sql'

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

    def fix(self, packet_runner):
        self.apply_dml_file(self.sql_planta_de_dbms, self.sql_script)

        return self.success()