(Feat-Fix): Added unit display and completion in work allocation system, and ability to edit completed units. Fixed contractor reporting system not displaying data under corresponding departments.
This commit is contained in:
15
backend-deno/scripts/add_completed_units.sql
Normal file
15
backend-deno/scripts/add_completed_units.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
-- Add completed_units column to work_allocations table
|
||||
-- Run this migration to support tracking completed units separately from total units
|
||||
-- Note: MySQL 8.0 does not support IF NOT EXISTS for ADD COLUMN
|
||||
|
||||
-- Check if column exists before running:
|
||||
-- SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'work_allocations' AND COLUMN_NAME = 'completed_units';
|
||||
|
||||
-- Add the column (will error if already exists)
|
||||
ALTER TABLE work_allocations
|
||||
ADD COLUMN completed_units DECIMAL(10,2) DEFAULT 0 AFTER units;
|
||||
|
||||
-- Update existing records to set completed_units equal to units for completed allocations
|
||||
UPDATE work_allocations
|
||||
SET completed_units = units
|
||||
WHERE status = 'Completed' AND units IS NOT NULL;
|
||||
Reference in New Issue
Block a user