Backfill Issues[start_date,due_date] with WorkItems::DatesSource
What does this MR do and why?
Backfill Issues[start_date,due_date] with WorkItems::DatesSource
The work_item_dates_sources
table/model was created to be the
definitive dates sources for any work item. The idea is to migrate all
the dates fields from issues to the work_item_dates_sources
table
(#461565), then remove the
dates fields from the issues
table, making the
work_item_dates_sources
table the Single Source of Truth (SSoT) for
work item's dates.
However, during this transition period, where we're migrating epics 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).
To avoid these current problems, and also 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, making the issues
table the current SSoT for
dates.
Related to: #469379 (closed)
Backfill Query
UPDATE
"issues"
SET
(start_date, due_date) = (
SELECT
"work_item_dates_sources"."start_date",
"work_item_dates_sources"."due_date"
FROM
"work_item_dates_sources"
WHERE
"work_item_dates_sources"."issue_id" >= 613
AND "work_item_dates_sources"."issue_id" < 1613
AND ("work_item_dates_sources"."issue_id" = "issues"."id")
)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.