SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = '#agencyDbName#'
AND TABLE_NAME = 'pPayer'
AND COLUMN_NAME = 'EVV_Payer_ID'
ALTER TABLE #agencyDbName#.pPayer ADD COLUMN EVV_Payer_ID VARCHAR(50) NULL AFTER EVV
✓ Added EVV_Payer_ID column to #agencyDbName#.pPayer
ALTER TABLE #agencyDbName#.pPayer MODIFY COLUMN EVV_Payer_ID VARCHAR(50) NULL COMMENT 'EVV Payer ID for visit transmission when EVV is enabled'
✓ Added comment to EVV_Payer_ID column in #agencyDbName#
CREATE INDEX idx_evv_payer_id ON #agencyDbName#.pPayer(EVV_Payer_ID)
✓ Created index on EVV_Payer_ID in #agencyDbName#
✓ EVV_Payer_ID column already exists in #agencyDbName# - skipping
✗ Failed to migrate #agencyDbName#: #cfcatch.message#
DESCRIBE #Request.prefix_db_agency#.pPayer
Column Verification:
Field
Type
Null
Key
Default
Extra
#Field#
#Type#
#Null#
#Key#
#Default#
#Extra#
✓ EVV Payer ID Migration completed successfully!
The EVV_Payer_ID column has been added to the pPayer table and is ready for use.
SELECT DISTINCT table_schema as db_name
FROM information_schema.tables
WHERE table_name = 'pSchedules'
AND table_schema LIKE 'agency_%'
AND table_schema NOT LIKE '%lookup%'
ORDER BY table_schema
Found #getAgencies.recordCount# agency databases to migrate
Processing Database: #db_name#
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = '#db_name#'
AND TABLE_NAME = 'pSchedules'
AND COLUMN_NAME = 'unstable_action'
ALTER TABLE #db_name#.pSchedules
ADD COLUMN unstable_action VARCHAR(255) NULL
COMMENT 'Clinician action for handling unstable problems'
✓ Added unstable_action column to #db_name#.pSchedules
CREATE INDEX idx_unstable_action ON #db_name#.pSchedules(unstable_action)
✓ Created index on unstable_action in #db_name#
✓ Index already exists or couldn't be created in #db_name# (not critical)
✓ unstable_action column already exists in #db_name# - skipping
✗ Failed to migrate #db_name#: #cfcatch.message#
✓ Unstable Action Field Migration Summary:
- Total Agencies: #getAgencies.recordCount#
- Successfully Added: #successCount#
- Already Existed (Skipped): #skipCount#
✓ Future migration 1 completed successfully!
✓ Future migration 2 completed successfully!
✗ Unknown migration type: #migrationType#
✗ Migration failed: #cfcatch.message#
Detail: #cfcatch.detail#
SQL State: #cfcatch.sqlState#
Error Code: #cfcatch.errorCode#
EVV Payer ID Migration
Adds EVV_Payer_ID column to pPayer table for ALL active agencies. This stores EVV payer identifiers when EVV is enabled for each agency.
-- Add EVV_Payer_ID column to pPayer table (after EVV column)
ALTER TABLE pPayer ADD COLUMN EVV_Payer_ID VARCHAR(50) NULL AFTER EVV;
-- Add comment to document the field purpose
ALTER TABLE pPayer MODIFY COLUMN EVV_Payer_ID VARCHAR(50) NULL COMMENT 'EVV Payer ID for visit transmission when EVV is enabled';
-- Create index for better performance on EVV_Payer_ID lookups
CREATE INDEX idx_evv_payer_id ON pPayer(EVV_Payer_ID);
🔧 Generic Column Creator Tool (Universal)
Add ANY column to ANY table for all agency databases with a user-friendly form interface.
✨ Choose table name dynamically
📝 Specify column name, type, nullable, default value
💬 Add comments and position (AFTER clause)
📊 Optional index creation
🔍 SQL preview before execution
✅ Safe: Checks for existing columns
Perfect for: Any future column additions without creating new migration files!
-- Dynamically generated based on your form input
-- Example:
ALTER TABLE {agency_db}.pSchedules
ADD COLUMN your_column_name VARCHAR(255) NULL
COMMENT 'Your description';
CREATE INDEX idx_your_column ON {agency_db}.pSchedules(your_column_name);
Adds unstable_action column to pSchedules table for ALL agency databases. This field stores the clinician's action for handling unstable problems (vitals/symptoms) during patient visits:
"Re-evaluate at next visit. Do not report to physician."
"Report unstable problems to physician"
Affected: All agency databases (agency_*) Table: pSchedules
-- Add unstable_action column to pSchedules table
ALTER TABLE {agency_db}.pSchedules
ADD COLUMN unstable_action VARCHAR(255) NULL
COMMENT 'Clinician action for handling unstable problems';
-- Create index for better performance
CREATE INDEX idx_unstable_action ON {agency_db}.pSchedules(unstable_action);
Template for future database migrations. Copy this structure for new migrations.
-- Example future migration
-- ALTER TABLE example_table ADD COLUMN new_field VARCHAR(100) NULL;
-- CREATE INDEX idx_new_field ON example_table(new_field);
Important: Always backup your database before running any migrations.
This tool is designed to be safe and will check for existing columns before creating them.