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



class AddQualityGateColumnsToSetEndDate(SQLPacket):
    """Add columns to define the temporal distance to set the wished end date for a quality gate"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 21166

    sql_script = 'WI21166_add_qg_fields_to_set_end_dates.sql'

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

    def fix(self, packet_runner):
        self.apply_dml_file(self.sql_planta_de_dbms, self.sql_script,split=True)
        self.log("Schema changes done!.")
        return self.success()