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

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

class FixEVABaseline(SQLPacket):
    """Change procedure P_RunningSum_827 to include baselines"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 18444

    SQL_FILE = 'WI18444_p_runningsum_827.sql'

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

    def fix(self, packet_runner):
        if self.DBMS == DBMS_MSSQL:
            self.apply_fix_ddl_file(self.sql_planta_de_dbms, self.SQL_FILE, split=True, separator='^GO$')
        elif self.DBMS == DBMS_ORACLE:
            self.apply_fix_ddl_file(self.sql_planta_de_dbms, self.SQL_FILE, split=False)
        return self.success()
