LedgerSMB Documentation

Description manuals and libraries
LedgerSMB Documentation > Perl Modules > LedgerSMB::Upgrade_Tests
Source

NAME

LedgerSMB::Upgrade_Tests - Upgrade tests for LedgerSMB

SYNPOPSIS

 TODO

DESCRIPTION

This module has a single function that returns upgrade tests.

FUNCTIONS

get_tests()

Returns the test array

get_by_name($name)

Returns the test object with the name.

TEST DEFINITION

Each test is a Moose object with the following properties (optional ones marked as such).

name

Name of the test

min_version

The first version to run this against

max_version

The maximum version to run this against

appname

The appname of the application the test belongs to. Can currently be 'ledgersmb' or 'sql-leder'.

test_query

Text of the query to run

table

Repair query table to run once per result.

selectable_values

Hash specifying for each column (identified by the key) which query to execute to retrieve the values to fill the drop-down with.

Each query needs to return 2 columns: text and value, where value is the value to be stored in the (fixed) record and text is the textual value to be presented in the UI.

force_queries

Array of queries to run on Force. Typically, they will be use to remove missing or invalid values from tables. For example, removing references to a missing business discount from the customer and vendor tables. The data is still good because the discount has been applied but we cannot find the actual values at the time.

insert

Insert data instead of update. This to set defaults on a very limited subset of tables. Business, for example isn't required in SQL-Ledger but mandatory for LedgerSMB.

id_columns

Repair columns to use as ids

columns

Repair query columns to run once per result

display_cols

columns to display on test failures

display_name

Human readable, localized display name

instructions

Human readable instructions for test, localized.

buttons

Enabled buttons

tooltips

Tooltip for each button. Validate that buttons are enabled for each tooltip, then prepend defaults and override with test specific labeling.

Methods

run($dbh, $cb)

Runs the verification query against the $dbh, calling the callback $cb with these arguments on failure: $self, $dbh, $sth.

Returns a falsish value on failure or trueish on success.

fix($dbh, $fix_values)

Applies data fixes. Intended to be used to resolve data-issues reported to the callback $cb of the run method.

$fix_values is an arrayref holding hashrefs with the keys being the names of the columns and the values the data to be applied for that column. Columns listed in id_columns must be part of the data supplied.

force($dbh)
query_selectable_values($dbh)

Returns an arrayref with the keys being the names of the columns and the values arrays of hashes. Each hash has two keys (text and value); the values are the allowable values for the given column in $fix_values when calling fix().

LICENSE AND COPYRIGHT

Copyright (C) 2012-2020 The LedgerSMB Core Team

This file is licensed under the GNU General Public License version 2, or at your option any later version. A copy of the license should have been included with your software.