from ppms.migration import SQLPacket, PacketCategory, MinVersionDependency, VersionType


class RestoreOldOLEs(SQLPacket):
    """Changes traffic light OLEs back to their old design"""
    done_after_success = True
    run_on_startup = False
    category = PacketCategory.CATEGORY_HELPER
    wi_number = 20315

    sql_script = 'WI20315_restore_old_OLEs.sql'

    def get_dependencies(self):
        return MinVersionDependency(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)

        return self.success()
