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


class ChangeEffortThresholds(SQLPacket):
    """This migration packet restores the old "feature" of effort trafficlights being based on cost thresholds."""
    done_after_success = True
    run_on_startup = False
    category = PacketCategory.CATEGORY_OPTIONAL
    wi_number = 19980

    sql_script = 'WI19980_change_effort_thresholds.sql'

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

    def fix(self, packet_runner):
        self.apply_dml_file(self.sql_planta_de_ansi, self.sql_script)
        return self.success()
