Skip to content

Backfill issues dates fields from work_items_dates_source

Problem

The work_item_dates_sources table/model was created to be the definitives dates sources for any work item. The idea is to migrate all data from the dates fields on issues to the work_item_dates_sources table (#461565), then remove the dates fields from the issues table, making the work_item_dates_sources the Single Source of Truth (SSoT) for work item's dates.

However, during this transition period, of the epic to work items, we have some records with dates in the issues table and others (work items epics) on the work_item_dates_sources table. Which is causing some difficulties to build some filtering queries (Example: #457009 (comment 1967594133)).

Proposed solution

To avoid these current problems, and to avoid having to do the large migration of all the dates data from the issues table to the work_item_dates_source table, we decided to backfill the dates fields from the work_item_dates_sources table to the issues table and ensure that every write to the work_item_dates_sources table is also done on the issues table.

How

  1. Add a trigger on the WorkItems::DatesSource to ensure every work_item_dates_source record also updates the issues correspondent fields
  2. Backfill the data from the work_item_dates_source table to the issues correspondent fields
Edited by Kassio Borges