update status's on tickets
This commit is contained in:
43
migrations/009_simplify_status_workflow.sql
Normal file
43
migrations/009_simplify_status_workflow.sql
Normal file
@@ -0,0 +1,43 @@
|
||||
-- Migration 009: Simplify status workflow
|
||||
-- Removes "Resolved" status and adds "Pending" status
|
||||
-- Keeps only: Open, Pending, In Progress, Closed
|
||||
|
||||
-- First, update any existing tickets with "Resolved" status to "Closed"
|
||||
UPDATE tickets SET status = 'Closed' WHERE status = 'Resolved';
|
||||
|
||||
-- Delete all existing transitions with "Resolved"
|
||||
DELETE FROM status_transitions WHERE from_status = 'Resolved' OR to_status = 'Resolved';
|
||||
|
||||
-- Clear all existing transitions to rebuild clean workflow
|
||||
DELETE FROM status_transitions;
|
||||
|
||||
-- Define new simplified workflow with Pending status
|
||||
-- OPEN transitions
|
||||
INSERT INTO status_transitions (from_status, to_status, requires_comment, requires_admin) VALUES
|
||||
('Open', 'Pending', FALSE, FALSE), -- Waiting on external dependency
|
||||
('Open', 'In Progress', FALSE, FALSE), -- Start work
|
||||
('Open', 'Closed', TRUE, FALSE); -- Close without work (duplicate, won't fix, etc.)
|
||||
|
||||
-- PENDING transitions
|
||||
INSERT INTO status_transitions (from_status, to_status, requires_comment, requires_admin) VALUES
|
||||
('Pending', 'Open', FALSE, FALSE), -- Unblock and reopen
|
||||
('Pending', 'In Progress', FALSE, FALSE), -- Start work while pending
|
||||
('Pending', 'Closed', TRUE, FALSE); -- Close while pending
|
||||
|
||||
-- IN PROGRESS transitions
|
||||
INSERT INTO status_transitions (from_status, to_status, requires_comment, requires_admin) VALUES
|
||||
('In Progress', 'Open', FALSE, FALSE), -- Stop work, back to queue
|
||||
('In Progress', 'Pending', FALSE, FALSE), -- Blocked by external dependency
|
||||
('In Progress', 'Closed', TRUE, FALSE); -- Complete and close
|
||||
|
||||
-- CLOSED transitions
|
||||
INSERT INTO status_transitions (from_status, to_status, requires_comment, requires_admin) VALUES
|
||||
('Closed', 'Open', TRUE, FALSE), -- Reopen (requires explanation)
|
||||
('Closed', 'In Progress', FALSE, FALSE); -- Reopen and start work immediately
|
||||
|
||||
-- Verify new transitions
|
||||
SELECT 'New Status Transitions:' as info;
|
||||
SELECT from_status, to_status, requires_comment, requires_admin
|
||||
FROM status_transitions
|
||||
WHERE is_active = TRUE
|
||||
ORDER BY from_status, to_status;
|
||||
118
migrations/MIGRATION_009_INSTRUCTIONS.md
Normal file
118
migrations/MIGRATION_009_INSTRUCTIONS.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# 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';
|
||||
```
|
||||
Reference in New Issue
Block a user