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


class AddMissingColumnDT343(SQLPacket):
    """
    Adds a missing column to DT343
    """

    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 16509

    sql_file = 'WI16509_add_missing_column_DT343.sql'

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

    def fix(self, runner):
        self.apply_dml_file(self.sql_planta_de_dbms, self.sql_file)

        return self.success()