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



class AddQGDoneOnFieldForPL(SQLPacket):
    """Add column for PL to define a finish date for a Qualtiy Gate"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 21496

    sql_script = 'WI21496_add_qg_done_on_field_for_pl.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()