Skip to content

Relate Requirements and Requirement Issues

charlie ablett requested to merge 323779-3-issue_id_on_requirement into master

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

Availability and Testing

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

Merge request reports

Loading