# -*- coding: utf-8 -*-

from ppms.migration import SQLPacket, MaxVersionDependency, PacketCategory


class TooManyOpenSessionsGlobal(SQLPacket):
    '''Adds a message that informs user if new session is denied because there are too many open sessions already'''
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 13212

    def get_dependencies(self):
        return (MaxVersionDependency('39.5.6'), )

    def fix(self, runner):
        file = 'WI13212_too_many_open_sessions_global.sql'

        self.apply_dml_file(self.sql_planta_de_dbms, file)

        return self.success()