Add new database table triggers for work item descriptions
Sync Work Items Description Table with Issues
Overview
This merge request implements comprehensive synchronization between the issues table and the new work_items_description table to ensure data consistency across the application.
Changes
1. Database Triggers for Real-time Sync
- Added database triggers to automatically sync new and updated records from the
issuestable to thework_items_descriptiontable - Triggers ensure that any changes to relevant fields are immediately reflected in the new table structure
- Provides real-time data consistency without application-level intervention
2. Search Vector Synchronization
- Integrated saving to the
work_items_descriptiontable alongside existing PG full text search updates on theissuestable - Ensures search vectors remain synchronized across both table structures
3. Project and Group Transfer Event Handling
- Added subscription to project transfer and group transfer events
- Automatically updates
root_namespace_idinwork_items_descriptionrecords when namespace changes occur during transfers - Processing handled as background jobs via Sidekiq for optimal performance
- Batch processing prevents database overload during large transfer operations
Technical Notes
- All synchronization mechanisms work together to maintain data integrity
- Background job processing ensures transfers don't impact application performance
- Batch operations provide scalability for large namespace changes
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
1. Test Issue Description Sync
- Create an issue in any project
- In the Rails console, run this query to verify synchronization:
# Check if work_item_description record matches issue description WorkItem.last.work_item_description - Update the issue description and verify the work_item_description table reflects the changes
2. Test Project Transfer
- Transfer the project to another root namespace
- Verify that the
root_namespace_idin the work_item_description table has been updated to match the new namespace
3. Test Epic Behavior
- Repeat the same validation steps for epics in groups
- Epic synchronization should behave identically to issue synchronization
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Gosia Ksionek