Add Adjust Contract Balance Field to Visits_payments

Add Adjust Contract Balance Field to Visits_payments

This migration will add the adjust_contract_balance column to the Visits_payments table for all agency databases.

⚠️ Important: This migration will modify the Visits_payments table structure for all agencies. Always backup your database before running migrations.

What This Migration Does:

SQL to Execute:

-- Add adjust_contract_balance column to Visits_payments table ALTER TABLE {agency_db}.Visits_payments ADD COLUMN adjust_contract_balance VARCHAR(10) NULL DEFAULT 'No' COMMENT 'Yes/No flag to include write-off amounts in contract balance calculations';

Migration Progress:

SELECT DISTINCT table_schema as db_name FROM information_schema.tables WHERE table_name = 'Visits_payments' AND table_schema LIKE 'agency_%' AND table_schema NOT LIKE '%lookup%' ORDER BY table_schema
Found #getAgencies.recordCount# agency database(s) to migrate
SELECT COUNT(*) as col_exists FROM information_schema.columns WHERE table_schema = '#db_name#' AND table_name = 'Visits_payments' AND column_name = 'adjust_contract_balance' ALTER TABLE #db_name#.Visits_payments ADD COLUMN adjust_contract_balance VARCHAR(10) NULL DEFAULT 'No' COMMENT 'Yes/No flag to include write-off amounts in contract balance calculations'
✓ Added adjust_contract_balance column to #db_name#.Visits_payments
✓ adjust_contract_balance column already exists in #db_name#.Visits_payments - skipping
✗ Failed to add column to #db_name#.Visits_payments: #cfcatch.message#
✗ Failed to retrieve agency databases: #cfcatch.message#
🎉 Migration Complete!
  • Total Agencies: #getAgencies.recordCount#
  • Successfully Added: #successCount#
  • Already Existed (Skipped): #skipCount#
  • Errors: #errorCount#

The adjust_contract_balance column has been successfully added to all Visits_payments tables.

The system can now track whether write-off amounts should be included in contract balance calculations for AR reporting.

⚠️ Some errors occurred during migration. Please review the error messages above and retry if necessary.


Go to Apply Payment Screen Back to Migrations