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


class AddNewRiskChanceSums(SQLPacket):
    "Adding new columns for risk/chance calculation on project"
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 16769

    create_dis = 'WI16769_new_risk_chance_sums.sql'
    
    def get_dependencies(self):
        return (MinVersionDependency(version='39.5.6' ,
                                     version_type=VersionType.CUSTOMIZING),
                MaxVersionDependency(version='39.5.6' ,
                                     version_type=VersionType.CUSTOMIZING))

    def fix(self, runner):
        self.apply_dml_file(self.sql_planta_de_dbms, self.create_dis)
            
        return self.success()