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


class FixCrcColumnLength(SQLPacket):
    '''Fix the column length of crc columns in hyperlink tables'''
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 14340

    sql_file = 'WI14340_fix_crc_column_length.sql'

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

    def fix(self, runner):
        self.apply_fix_ddl_file(self.sql_planta_de_dbms, self.sql_file, True)

        return self.success()