Add Hospice Field to pProblem
This migration will add the hospice INT field to the pProblem table for all agency databases.
⚠️ Important: This migration will modify the pProblem table structure for all agencies.
Always backup your database before running migrations.
What This Migration Does:
- Adds
hospice INT column to pProblem table
- Used to track hospice designation for diagnoses in hospice/palliative admissions
- Default value is NULL (0 or 1 when set via checkbox)
- Applies to all agency databases (agency_*)
SQL to Execute:
-- Add hospice column to pProblem table
ALTER TABLE {agency_db}.pProblem
ADD COLUMN hospice INT NULL
COMMENT 'Hospice designation checkbox for diagnoses (0 or 1)';
Migration Progress:
SELECT DISTINCT table_schema as db_name
FROM information_schema.tables
WHERE table_name = 'pProblem'
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 = 'pProblem'
AND column_name = 'hospice'
ALTER TABLE #db_name#.pProblem
ADD COLUMN hospice INT NULL
COMMENT 'Hospice designation checkbox for diagnoses (0 or 1)'
✓ Added hospice column to #db_name#.pProblem
✓ hospice column already exists in #db_name#.pProblem - skipping
✗ Failed to add column to #db_name#.pProblem: #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 hospice column has been successfully added to all pProblem tables.
The system can now track hospice designation for diagnoses in hospice/palliative admissions.
⚠️ Some errors occurred during migration. Please review the error messages above and retry if necessary.
Go to Diagnosis Grid
Back to Migrations