Test-NAVApplicationTable

Tests changes in Business Central application table objects to validate whether the changes are breaking or destructive.

Syntax

Test-NAVApplicationTable
    [-OriginalPath] <String>
    [-ModifiedPath] <String>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Before you upgrade an application with changes to table objects, it can be useful to know whether any changes are breaking or destructive. This includes changes such as:

  • Deleting a field
  • Changing a field's data type or class
  • Changing the SQL data type of a field
  • Decreasing the length of a field
  • Changing the primary key of a table.

Limiting the number of destructive changes in the application can make the upgrade process more efficient. You can use the Test-NavApplicationTable cmdlet to determine whether specific modified tables of the application include any destructive changes, and then to appropriate action.

The test works by comparing the original version of a table object (before changes) with its modified version (after changes). It requires that you provide the original version and the modified version of the table object as text in separate .txt files. These .txt files can contain more than one table object. When the cmdlet is run, it compares the original and modified files to validate the changes, and returns the result as follows:

  • If the test detects changes that are not allowed, it fails, and an exception is thrown with the message "Changes in Application Table(s) are not allowed.".
  • If all the changes are allowed, the test succeeds, and the message "Changes in Application Table(s) are allowed." is returned.

For example, if you modified table 27 to include a new field compared to the original version, then the Test-NavApplicationTable cmdlet will succeed. However, if you modified table 27 so that it removes a field compared to the original version, the Test-NavApplicationTable cmdlet will throw an exception.

Examples

EXAMPLE 1

Test-NavApplicationTable -OriginalPath C:\Solution\ORIGINAL\TAB*.txt -ModifiedPath C:\Solution\MODIFIED\TAB*.txt

Changes in Application Table(s) are not allowed.

This example compares and tests the application tables changes contained in .txt files starting with 'TAB' in the 'C:\Solution\MODIFIED' and 'C:\Solution\ORIGINAL' folder. In this example, one or more of the tables contained destructive changes. Therefore, the cmldet returned the message "Changes in Application Table(s) are not allowed.".

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ModifiedPath

Specifies the path and file names of the application table object .txt files that contain the modified tables for comparing to the original versions.

For example, to compare all text files in the MODIFIED folder that is a subfolder to the current folder, type '.\MODIFIED*.txt'.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-OriginalPath

Specifies the path and file names of the application table object .txt files to use as the baseline in the test.

For example, to use all text files in the ORIGINAL folder that is a subfolder to the current folder, type '.\ORIGINAL*.txt'.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False