Old system notes on epics should link to referenced issues.
This issue was created in order to address the old epic system notes that should have links to issues. As suggested by @fjsanpedro, it will require a migration. @jprovaznik gave some insight as @smcgivern is currently OOO. Will @gl-database run the queries he mentioned when time permits?
Related issue:
#6318 (closed) - System notes generated on epics should link to referenced issues.
Related MR:
!7407 (merged) - Add link to issue on epic.
@jprovaznik's suggested queries for the db team:
Perhaps we could check on production how many notes would require an update. @gl-database could you please run following queries on production when you have a minute?:
Note.system.where(noteable_type: 'Epic').joins(:system_note_metadata).where('system_note_metadata.action': %w(epic_issue_added epic_issue_moved epic_issue_removed)).count:
SELECT COUNT(*) FROM "notes" INNER JOIN "system_note_metadata" ON "system_note_metadata"."note_id" = "notes"."id" WHERE "notes"."system" = $1 AND "notes"."noteable_type" = $2 AND "system_note_metadata"."action" IN ('epic_issue_added', 'epic_issue_moved', 'epic_issue_removed') [["system", "t"], ["noteable_type", "Epic"]]
and for getting epics count:
Note.system.where(noteable_type: 'Epic').joins(:system_note_metadata).where('system_note_metadata.action': %w(epic_issue_added epic_issue_moved epic_issue_removed)).select(:noteable_id).distinct.count:
SELECT DISTINCT COUNT(DISTINCT "notes"."noteable_id") FROM "notes" INNER JOIN "system_note_metadata" ON "system_note_metadata"."note_id" = "notes"."id" WHERE "notes"."system" = $1 AND "notes"."noteable_type" = $2 AND "system_note_metadata"."action" IN ('epic_issue_added', 'epic_issue_moved', 'epic_issue_removed') [["system", "t"], ["noteable_type", "Epic"]]