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

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

class FetchSizeLimits(SQLPacket):
    '''Add dialog messages and global variables for fetch size limit handling'''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 12982

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

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

        self.apply_dml_file(self.sql_planta_de_dbms, file)

        return self.success()