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

from ppms.constants import *
from ppms.migration import PacketCategory, MaxVersionDependency, SQLPacket

class FixP_RunningSum_827_Ora(SQLPacket):
    """Fix procedure P_RunningSum_827 in Oracle"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 18209

    SQL_FILE = 'WI18209_fix_p_runningsum_827_ora.sql'

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

    def fix(self, packet_runner):
        if self.DBMS == DBMS_ORACLE:
            self.apply_fix_ddl_file(self.sql_planta_de_dbms, self.SQL_FILE, split=False)
            return self.success()
        else:
            return self.success()