======================================== ASSESSMENTS TABLE COLUMN ANALYSIS ======================================== SCHEMA DEFINITION (all columns): ---------------------------------- 1. id (AUTO_INCREMENT) - skip in INSERT 2. assessment_number - REQUIRED in INSERT 3. title - REQUIRED in INSERT 4. location_id - REQUIRED in INSERT 5. visit_date - REQUIRED in INSERT 6. visit_time - OPTIONAL in INSERT 7. assessor_id - OPTIONAL in INSERT 8. status - OPTIONAL in INSERT (has default) 9. is_locked - OPTIONAL (has default 0) 10. overall_risk_level - OPTIONAL (nullable) 11. vehicle_type - OPTIONAL in INSERT 12. delivery_type - OPTIONAL in INSERT 13. weather_conditions - OPTIONAL in INSERT 14. additional_notes - OPTIONAL in INSERT 15. description - OPTIONAL in INSERT 16. created_by - SHOULD BE IN INSERT 17. updated_by - SHOULD BE IN INSERT 18. created_at (DEFAULT) - skip in INSERT 19. updated_at (DEFAULT) - skip in INSERT CURRENT INSERT STATEMENT ANALYSIS: ---------------------------------- Columns included: ✓ assessment_number ✓ title ✓ location_id ✓ visit_date ✓ visit_time ✓ assessor_id ✓ status ✓ delivery_type ✓ vehicle_type ✓ weather_conditions ✓ description ✓ created_by ✓ updated_by Missing but nullable/default: - is_locked (has default 0) - overall_risk_level (nullable) - additional_notes (nullable) RECOMMENDED INSERT: ---------------------------------- Should include ALL user-settable fields: 1. assessment_number 2. title 3. location_id 4. visit_date 5. visit_time 6. assessor_id 7. status 8. is_locked 9. overall_risk_level 10. vehicle_type 11. delivery_type 12. weather_conditions 13. additional_notes 14. description 15. created_by 16. updated_by CURRENT UPDATE STATEMENT ANALYSIS: ---------------------------------- Columns being updated: ✓ title ✓ description ✓ delivery_type ✓ vehicle_type ✓ weather_conditions ✓ status Missing from UPDATE: ✗ visit_date ✗ visit_time ✗ location_id ✗ assessor_id ✗ additional_notes ✗ updated_by (CRITICAL!) RECOMMENDED UPDATE: ---------------------------------- Should include ALL editable fields: 1. title 2. description 3. visit_date 4. visit_time 5. location_id (if allowing location change) 6. assessor_id (if allowing reassignment) 7. delivery_type 8. vehicle_type 9. weather_conditions 10. additional_notes 11. status 12. updated_by (CRITICAL!) 13. updated_at = NOW()