# Migration 009: Simplify Status Workflow This migration removes the "Resolved" status and adds a "Pending" status to the ticket system. ## Status Changes ### Before (4 statuses): - Open - In Progress - **Resolved** ❌ (being removed) - Closed ### After (4 statuses): - Open - **Pending** ✅ (new) - In Progress - Closed ## What "Pending" Means **Pending** status indicates a ticket is waiting on: - External dependencies - Third-party responses - Parts/equipment to arrive - Customer information - Approval from another team Unlike "In Progress" which means active work is happening, "Pending" means the ticket is blocked and waiting. ## Running the Migration On the tinkertickets server, run: ```bash cd /var/www/html/tinkertickets/migrations mysql -h 10.10.10.50 -u tinkertickets -p'&*woX!5R$x8Tyrm7zNxC' ticketing_system < 009_simplify_status_workflow.sql ``` ## What the Migration Does 1. Updates any existing tickets with status "Resolved" to "Closed" 2. Deletes all status transitions involving "Resolved" 3. Creates new workflow with "Pending" status 4. Sets up the following allowed transitions: ### New Workflow Transitions: **From Open:** - → Pending (no comment required) - → In Progress (no comment required) - → Closed (requires comment) **From Pending:** - → Open (no comment required) - → In Progress (no comment required) - → Closed (requires comment) **From In Progress:** - → Open (no comment required) - → Pending (no comment required) - → Closed (requires comment) **From Closed:** - → Open (requires comment - explain why reopening) - → In Progress (no comment required) ## CSS Updates The following CSS files have been updated: - ✅ `/assets/css/dashboard.css` - Added `.status-Pending` styling with purple color (#9c27b0) and pause icon - ✅ `/assets/css/ticket.css` - Added `.status-Pending` styling ## Visual Appearance The Pending status will display as: ``` [⏸ PENDING] ``` - Purple color border and text - Pause icon (⏸) to indicate waiting state - Terminal-style glow effect ## Verification After running the migration, verify: 1. Check that all tickets previously marked "Resolved" are now "Closed": ```sql SELECT COUNT(*) FROM tickets WHERE status = 'Resolved'; -- Should be 0 SELECT COUNT(*) FROM tickets WHERE status = 'Closed'; ``` 2. Check new transitions exist: ```sql SELECT from_status, to_status FROM status_transitions WHERE from_status = 'Pending' OR to_status = 'Pending' ORDER BY from_status, to_status; ``` 3. Test creating a new ticket and changing its status to Pending in the UI ## Rollback (if needed) If you need to rollback this migration: ```sql -- Restore Resolved status transitions DELETE FROM status_transitions WHERE from_status = 'Pending' OR to_status = 'Pending'; INSERT INTO status_transitions (from_status, to_status, requires_comment) VALUES ('In Progress', 'Resolved', FALSE), ('Resolved', 'Closed', FALSE), ('Resolved', 'In Progress', TRUE), ('Open', 'Resolved', FALSE); -- Update any Pending tickets to Open UPDATE tickets SET status = 'Open' WHERE status = 'Pending'; ```