Add Unstable Action Field to pSchedules
This migration will add the unstable_action column to the pSchedules table for all agency databases.
⚠️ Important: This migration will modify the pSchedules table structure for all agencies.
Always backup your database before running migrations.
What This Migration Does:
- Adds
unstable_action VARCHAR(255) column to pSchedules
- Stores clinician's action for handling unstable problems:
- "Re-evaluate at next visit. Do not report to physician."
- "Report unstable problems to physician"
- Adds index for better query performance
- Applies to all agency databases (agency_*)
SQL to Execute:
-- 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 (vitals/symptoms)';
-- Add index for better performance
CREATE INDEX idx_unstable_action ON {agency_db}.pSchedules(unstable_action);
Migration Progress:
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 database(s) to migrate
SELECT COUNT(*) as col_exists
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 (vitals/symptoms)'
CREATE INDEX idx_unstable_action ON #db_name#.pSchedules(unstable_action)
✓ Added unstable_action column#indexMsg# to #db_name#.pSchedules
✓ unstable_action column already exists in #db_name#.pSchedules - skipping
✗ Failed to add column to #db_name#.pSchedules: #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 unstable_action column has been successfully added to all pSchedules tables.
The system can now track clinician actions for handling unstable problems in patient visits.
⚠️ Some errors occurred during migration. Please review the error messages above and retry if necessary.
Go to Patient Visit Screen
Back to Migrations