Skip to content

Allow filtering epics by custom fields

What does this MR do and why?

Support filtering by custom fields in the epics and epic boards GraphQL fields.

Legacy epics are in the process of being migrated to work items. Right now, every epic record has a corresponding row in the issues table. So work item features like custom fields can apply to epics when using the work item UI.

For the epic list and epic boards though, the frontend for this is still in progress so this MR adds the filter argument to the legacy fields so we can filter by custom fields even on the legacy views.

This uses the same filter in !183312 (merged)

Query plan

https://postgres.ai/console/gitlab/gitlab-production-main/sessions/37208/commands/113899

Setup
INSERT INTO custom_fields
  (id, namespace_id, field_type, name, created_at, updated_at)
VALUES
  (9999, 9970, 0, 'select field', NOW(), NOW());


INSERT INTO custom_field_select_options
  (id, namespace_id, custom_field_id, position, value, created_at, updated_at)
VALUES
  (999901, 9970, 9999, 1, 'option 1', NOW(), NOW()),
  (999902, 9970, 9999, 2, 'option 2', NOW(), NOW()),
  (999903, 9970, 9999, 3, 'option 3', NOW(), NOW());

exec INSERT INTO work_item_select_field_values
  (namespace_id, work_item_id, custom_field_id, custom_field_select_option_id, created_at, updated_at)
SELECT
  9970,
  issue_id,
  9999,
  999900 + floor(random() * 3 + 1),
  NOW(),
  NOW()
FROM epics
WHERE group_id = 9970 AND issue_id NOT IN (SELECT work_item_id FROM work_item_select_field_values)
LIMIT 1000

References

Related to #515946 (closed)

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 Heinrich Lee Yu

Merge request reports

Loading