--- /dev/null
+\set ECHO
+\set QUIET 1
+-- Turn off echo and keep things quiet.
+
+-- Format the output for nice TAP.
+\pset format unaligned
+\pset tuples_only true
+\pset pager
+
+-- Revert all changes on failure.
+\set ON_ERROR_ROLLBACK 1
+\set ON_ERROR_STOP true
+\set QUIET 1
+
+-- Load the TAP functions.
+BEGIN;
+
+-- Plan the tests.
+SELECT plan(21);
+
+-- Check for new org_unit settings.
+SELECT isnt_empty(
+ 'SELECT * FROM config.org_unit_setting_type WHERE name = $$bill.prohibit_negative_balance_default$$',
+ 'bill.prohibit_negative_balance_default exists'
+);
+
+SELECT isnt_empty(
+ 'SELECT * FROM config.org_unit_setting_type WHERE name = $$bill.prohibit_negative_balance_on_overdues$$',
+ 'bill.prohibit_negative_balance_on_overdues exists'
+);
+
+SELECT isnt_empty(
+ 'SELECT * FROM config.org_unit_setting_type WHERE name = $$bill.prohibit_negative_balance_on_lost$$',
+ 'bill.prohibit_negative_balance_on_lost exists'
+);
+
+SELECT isnt_empty(
+ 'SELECT * FROM config.org_unit_setting_type WHERE name = $$bill.negative_balance_interval_default$$',
+ 'bill.negative_balance_interval_default exists'
+);
+
+SELECT isnt_empty(
+ 'SELECT * FROM config.org_unit_setting_type WHERE name = $$bill.negative_balance_interval_on_overdues$$',
+ 'bill.negative_balance_interval_on_overdues exists'
+);
+
+SELECT isnt_empty(
+ 'SELECT * FROM config.org_unit_setting_type WHERE name = $$bill.negative_balance_interval_on_lost$$',
+ 'bill.negative_balance_interval_on_lost exists'
+);
+
+-- Check for schema changes.
+-- Check for new table: money.void_payment, its indexes, and triggers.
+SELECT has_table('money', 'void_payment', 'money.void_payment table exists');
+SELECT has_index('money', 'void_payment', 'money_void_payment_xact_idx',
+ ARRAY['xact'], 'money_void_payment_xact_idx index exists');
+SELECT has_index('money', 'void_payment', 'money_void_payment_bill_idx',
+ ARRAY['billing'], 'money_void_payment_bill_idx index exists');
+SELECT has_index('money', 'void_payment', 'money_void_payment_payment_ts_idx',
+ ARRAY['payment_ts'], 'money_void_payment_payment_ts_idx index exists');
+SELECT has_index('money', 'void_payment', 'money_void_payment_accepting_usr_idx',
+ ARRAY['accepting_usr'], 'money_void_payment_accepting_usr_idx index exists');
+SELECT has_trigger('money', 'void_payment', 'mat_summary_add_tgr',
+ 'mat_summary_add_tgr trigger exists');
+SELECT has_trigger('money', 'void_payment', 'mat_summary_upd_tgr',
+ 'mat_summary_upd_tgr trigger exists');
+SELECT has_trigger('money', 'void_payment', 'mat_summary_del_tgr',
+ 'mat_summary_del_tgr trigger exists');
+
+-- Check that columns were dropped from money.billing.
+SELECT hasnt_column('money', 'billing', 'voided',
+ 'column voided dropped from money.billing');
+SELECT hasnt_column('money', 'billing', 'void_time',
+ 'column void_time dropped from money.billing');
+SELECT hasnt_column('money', 'billing', 'voider',
+ 'column voider dropped from money.billing');
+
+-- Make sure the view, money.billable_xact_with_void_summary, was dropped.
+SELECT hasnt_view('money', 'billable_xact_with_void_summary',
+ 'view money.billable_xact_with_void_summary successfully dropped');
+
+-- Check for functions.
+SELECT has_function('money', 'materialized_summary_billing_add',
+ 'function money.materialized_summary_billing_add exists');
+SELECT has_function('money', 'materialized_summary_billing_update',
+ 'function money.materialized_summary_billing_update exists');
+SELECT has_function('money', 'materialized_summary_billing_del',
+ 'function money.materialized_summary_billing_del exists');
+
+-- Finish the tests and clean up.
+SELECT * FROM finish();
+ROLLBACK;