JH Epic support milestone and iteration in new page
What does this MR do and why?
Related issue: #3836 (comment 4330015)
License: Premium. FF, Self-Manage
Changelog: added
Feature flag is: epic_support_milestone_and_iteration
, The rollout issue: #4049
Advice of JH Database development
Naming guideline
-
Database table naming always use
jh_
prefix- If it is a upstream table' extend, then name it as
jh_xxxx_extends
- If it is a JH only table, then name it as
jh_xxxx
- If it is a upstream table' extend, then name it as
-
Model file path and naming
- If it is a JH only database model, we should place it always under the
jh/app/models/xxx/
folder, and use the definition form like below:# path: jh/app/models/extend/milestone.rb module Extend class Milestone < JH::ApplicationRecord # xxxx end end
- If it is a Upstream model override module, we should place it always under the
jh/app/models/jh/
folder, and use the definition form like below:# path: jh/app/models/jh/milestone.rb module JH module Milestone extend ActiveSupport::Concern extend ::Gitlab::Utils::Override # xxxx end end
- If it is a JH only database model, we should place it always under the
-
Model relationship naming
-
If it is a JH model of a database extend table(such as
jh_milestone_extends
), its relationship name should always excludes the_extends
suffix to make its meaning more clearer for code reading. such as thejh_milestone
string below:module JH module Milestone prepended do has_one :jh_milestone, class_name: 'Extend::Milestone' end end end # Then we can use the clearer naming method: upstream_milestone = Milestone.last upstream_milestone.jh_milestone # => Get data in the Jh extend table
-
How to set up and validate locally
-
Copy
jh/config/database.yml.example
contents intoconfig/database.yml
, modify it to fit your local development env. -
RESTART GDK!
-
Run
bundle exec rails db:create:jh
to create JH database -
Run
bundle exec rails db:migrate:jh
to perform the migrations, it should createjh_epic_extends jh_milestone_extends jh_sprint_extends
three tables -
Enable the feature flag in the rails console using
::Feature.enable(:epic_support_milestone_and_iteration)
-
Use
curl
to request the graphql API like below:curl --location 'http://gdk.test:3000/api/graphql' \ --header 'PRIVATE-TOKEN: <TOKEN>' \ --header 'Content-Type: application/json' \ --data '{"query":"mutation createEpic($input: CreateEpicInput!) {\n createEpic(input: $input) {\n epic {\n id\n webUrl\n __typename\n }\n errors\n __typename\n }\n}","variables":{"input":{"addLabelIds":[],"groupPath":"tragedxy","title":"xyz 789","description":"Just a xyz test","confidential":false,"startDateFixed":"2024-03-01","startDateIsFixed":true,"dueDateFixed":"2024-04-05","dueDateIsFixed":true,"milestoneId":60,"sprintId":41109}}}'
-
The response should be like this when create epic successfully:
{ "data": { "createEpic": { "epic": { "id": "gid://gitlab/Epic/82", "webUrl": "http://gdk.test:3000/groups/tragedxy/-/epics/42", "__typename": "Epic" }, "errors": [], "__typename": "CreateEpicPayload" } } }
-
Then could enter the rails console to check the created records in JH extend tables:
ue = Epic.last je = ue.jh_epic jm = je.jh_milestone um = jm.milestone ji = je.jh_iteration ui = ji.iteration