# -*- coding: utf-8 -*-
from ppms.constants import *
from ppms.migration import PacketCategory, MaxVersionDependency, SQLPacket

class FixV_EVA_VG(SQLPacket):
    """Fix view V_EVA_VG"""
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 17377

    SQL_FILE = 'WI17377_V_EVA_VG.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=True)
        elif self.DBMS == DBMS_MSSQL:
            self.apply_fix_ddl_file(self.sql_planta_de_dbms, self.SQL_FILE, split=True, separator='GO$')

        return self.success()