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


class AddQualityGateColumns(SQLPacket):
    """Adds the real columns required for the Quality Gates."""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 19888

    sql_script = 'WI19888_add_quality_gates.sql'

    def get_dependencies(self):
        return MaxVersionDependency(version='39.5.9', 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()