# -*- coding: latin-1 -*-
from ppms.migration import SQLPacket, PacketCategory, MaxVersionDependency, MinVersionDependency, VersionType
        
class AddObjectProtectionDT021(SQLPacket):
    ''' Add missing objectprotection DI to DT021'''
    
    wi_number = 14131
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY

    sql_file = 'wi14131_add_object_protection_dt021.sql'
    
    def get_dependencies(self):
        return (MinVersionDependency(version='39.5.0', version_type=VersionType.CUSTOMIZING),
                MaxVersionDependency(version='39.5.2', version_type=VersionType.CUSTOMIZING))
    
    def fix(self, runner):
        self.apply_dml_file(self.sql_planta_de_dbms, self.sql_file)
        
        return self.success()
        