[VSA] Implement the new DB queries
What
With the new database structure in place, we need to implement the query backend. We can implement a switch in lib/gitlab/analytics/cycle_analytics/base_query_builder.rb
so we can optionally use the new database and queries.
How
Implement finder classes for the new database tables created in #335386 (closed)
We need two separate finder classes for the following tables:
analytics_cycle_analytics_merge_request_stage_events
analytics_cycle_analytics_issue_stage_events
We can start with a base class because the two finders might diverge a bit later.
The following query params we need to support (ideally avoiding joins):
- stage_hash_id
- This parameter is always required
- root_group_id, group_id, project_id: one of them is always required
- author_username
- Find the author(s) from the DB and take the id(s). Query the
author_id
column.
- Find the author(s) from the DB and take the id(s). Query the
- milestone_title
- Find the milestone(s) from the DB and take the id(s). Query the
milestone_id
column.
- Find the milestone(s) from the DB and take the id(s). Query the
- start_event_timestamp (greater than)
- Query the
start_event_timestamp
column
- Query the
- end_event_timestamp (less than)
- Query the
end_event_timestamp
column
- Query the
Edited by Adam Hegyi