Add Wound Tunneling and Undermining Columns
This migration will add wnd_tunneling and wnd_underm columns to the pWoundsVitals and pProgress tables for all agency databases.
⚠️ Important: This migration will modify the pWoundsVitals and pProgress table structures for ALL agencies.
Always backup your database before running migrations.
What This Migration Does:
- Adds
wnd_tunneling VARCHAR(255) column to pWoundsVitals (after wnd_pain)
- Adds
wnd_underm VARCHAR(255) column to pWoundsVitals (after wnd_tunneling)
- Adds
wnd_tunneling VARCHAR(255) column to pProgress (after wnd_pain)
- Adds
wnd_underm VARCHAR(255) column to pProgress (after wnd_tunneling)
- All columns are VARCHAR(255), NULL allowed, default NULL
- Applies to all agency databases (agency_*)
SQL to Execute:
-- Add columns to pWoundsVitals table
ALTER TABLE {agency_db}.pWoundsVitals
ADD COLUMN wnd_tunneling VARCHAR(255) NULL DEFAULT NULL AFTER wnd_pain,
ADD COLUMN wnd_underm VARCHAR(255) NULL DEFAULT NULL AFTER wnd_tunneling;
-- Add columns to pProgress table
ALTER TABLE {agency_db}.pProgress
ADD COLUMN wnd_tunneling VARCHAR(255) NULL DEFAULT NULL AFTER wnd_pain,
ADD COLUMN wnd_underm VARCHAR(255) NULL DEFAULT NULL AFTER wnd_tunneling;
Migration Progress:
SELECT DISTINCT table_schema as db_name
FROM information_schema.tables
WHERE (table_name = 'pWoundsVitals' OR table_name = 'pProgress')
AND table_schema LIKE 'agency_%'
AND table_schema NOT LIKE '%lookup%'
GROUP BY table_schema
HAVING COUNT(DISTINCT table_name) >= 1
ORDER BY table_schema
Found #getAgencies.recordCount# agency database(s) to migrate
Processing #db_name#...
SELECT COUNT(*) as table_exists
FROM information_schema.tables
WHERE table_schema =
AND table_name =
Processing table: #tableInfo.tableName#
SELECT COUNT(*) as col_exists
FROM information_schema.columns
WHERE table_schema =
AND table_name =
AND column_name =
SELECT COUNT(*) as after_col_exists
FROM information_schema.columns
WHERE table_schema =
AND table_name =
AND column_name =
ALTER TABLE #db_name#.#tableInfo.tableName#
ADD COLUMN #columnInfo.name# VARCHAR(255) NULL DEFAULT NULL
AFTER #columnInfo.after#
✓ Added column #columnInfo.name# after #columnInfo.after# in #db_name#.#tableInfo.tableName#
ALTER TABLE #db_name#.#tableInfo.tableName#
ADD COLUMN #columnInfo.name# VARCHAR(255) NULL DEFAULT NULL
✓ Added column #columnInfo.name# to #db_name#.#tableInfo.tableName# (wnd_pain column not found, added at end)
ℹ Column #columnInfo.name# already exists in #db_name#.#tableInfo.tableName# - skipping
✗ Failed to add column #columnInfo.name# to #db_name#.#tableInfo.tableName#: #cfcatch.message#
ℹ Table #tableInfo.tableName# does not exist in #db_name# - skipping
✗ Failed to retrieve agency databases: #cfcatch.message#
🎉 Migration Complete!
- Total Agencies: #getAgencies.recordCount#
- Tables Per Agency: #ArrayLen(tablesToMigrate)#
- Successfully Added: #totalSuccess#
- Already Existed (Skipped): #totalSkipped#
- Errors: #totalErrors#
The wnd_tunneling and wnd_underm columns have been successfully added to the pWoundsVitals and pProgress tables across all agencies.
Migration complete.
⚠️ Some errors occurred during migration. Please review the error messages above and retry if necessary.
Back to Migrations