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


class AddPSPImportTimestamps(SQLPacket):
    """Adds the new timestamp columns to DT 461 to show the last import date and time of SAP PSP elements."""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 18924

    sql_script = 'WI18924_add_psp_import_timestamps.sql'

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

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

        return self.success()