Relate Requirements and Requirement Issues
What does this MR do?
Directly relate Requirement
and Issues
. Also, prevent non-Requirement issues from being related to a Requirement
.
See #323779 (closed) for overall strategy. We are iterating a small piece at a time so we can deliberate on any design decisions as we move Requirements to an issue type.
DB migration output
up
== 20210615064342 AddIssueIdToRequirement: migrating ==========================
-- add_column(:requirements, :issue_id, :bigint, {:null=>true})
-> 0.0007s
== 20210615064342 AddIssueIdToRequirement: migrated (0.0042s) =================
== 20210616110748 AddIssueIndexToRequirement: migrating =======================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:requirements, :issue_id, {:name=>"index_requirements_on_issue_id", :unique=>true, :algorithm=>:concurrently})
-> 0.0033s
-- execute("SET statement_timeout TO 0")
-> 0.0004s
-- add_index(:requirements, :issue_id, {:name=>"index_requirements_on_issue_id", :unique=>true, :algorithm=>:concurrently})
-> 0.0038s
-- execute("RESET ALL")
-> 0.0004s
== 20210616110748 AddIssueIndexToRequirement: migrated (0.0086s) ==============
== 20210616111311 AddIssueRequirementForeignKey: migrating ====================
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:requirements)
-> 0.0027s
-- execute("ALTER TABLE requirements\nADD CONSTRAINT fk_85044baef0\nFOREIGN KEY (issue_id)\nREFERENCES issues (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0016s
-- execute("SET statement_timeout TO 0")
-> 0.0005s
-- execute("ALTER TABLE requirements VALIDATE CONSTRAINT fk_85044baef0;")
-> 0.0038s
-- execute("RESET ALL")
-> 0.0004s
== 20210616111311 AddIssueRequirementForeignKey: migrated (0.0135s) ===========
down
== 20210616111311 AddIssueRequirementForeignKey: reverting ====================
-- foreign_keys(:requirements)
-> 0.0022s
-- remove_foreign_key(:requirements, {:column=>:issue_id})
-> 0.0025s
== 20210616111311 AddIssueRequirementForeignKey: reverted (0.0084s) ===========
== 20210616110748 AddIssueIndexToRequirement: reverting =======================
-- transaction_open?()
-> 0.0000s
-- indexes(:requirements)
-> 0.0029s
-- execute("SET statement_timeout TO 0")
-> 0.0004s
-- remove_index(:requirements, {:algorithm=>:concurrently, :name=>"index_requirements_on_issue_id"})
-> 0.0023s
-- execute("RESET ALL")
-> 0.0003s
== 20210616110748 AddIssueIndexToRequirement: reverted (0.0065s) ==============
== 20210615064342 AddIssueIdToRequirement: reverting ==========================
-- remove_column(:requirements, :issue_id)
-> 0.0007s
== 20210615064342 AddIssueIdToRequirement: reverted (0.0039s) =================
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Security
Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Related to #323779 (closed)
Edited by charlie ablett