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

class Entity2(SQLPacket, ChangeDTPPacket):
    '''
        part2 from add add_entity
    '''
    PACKET_PATH = 'migration.server.S_39_5_13.wi12349_add_entity.Entity'
    
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 13837

    fname = 'wi13837_entity_names2.sql'

    def get_dependencies(self):
        return (PacketDependency(packet_path=self.PACKET_PATH, expected_state=PacketState.INSTALLED),
                MaxVersionDependency(version='39.5.6'))

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