Skip to content

Add relationship and link to new epic to promoted issues

What does this MR do?

This MR adds an indication to promoted issues showing that they were promoted to an epic and linking to the created epic. As we do not currently have no reference to the new epic in the issue, it was necessary to add a new column + foreign key in the database containing the id of the new epic.

Note that this applies only to issues promoted after this goes live.

Screenshots

Promoted issue

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Cross-browser testing doesn't seem necessary here.

Database checklist

When adding migrations:

  • Updated db/schema.rb
  • Added a down method so the migration can be reverted
  • Added the output of the migration(s) to the MR body
  • [-] Added tests for the migration in spec/migrations if necessary (e.g. when migrating data) (unnecessary)
  • Added rollback procedure. Include either a rollback procedure or description how to rollback changes
Migration output
== 20191026120008 AddPromotedToEpicToIssues: migrating ========================
-- add_column(:issues, :promoted_to_epic_id, :integer)
   -> 0.0866s
== 20191026120008 AddPromotedToEpicToIssues: migrated (0.0867s) ===============

== 20191026120112 AddPromotedToEpicToIssuesIndex: migrating ===================
-- transaction_open?()
   -> 0.0000s
-- foreign_keys(:issues)
   -> 0.0065s
-- execute("ALTER TABLE issues\nADD CONSTRAINT fk_df75a7c8b8\nFOREIGN KEY (promoted_to_epic_id)\nREFERENCES epics (id)\nON DELETE SET NULL\nNOT VALID;\n")
   -> 0.5679s
-- execute("SET statement_timeout TO 0")
   -> 0.0006s
-- execute("ALTER TABLE issues VALIDATE CONSTRAINT fk_df75a7c8b8;")
   -> 0.0491s
-- execute("RESET ALL")
   -> 0.0005s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:issues, :promoted_to_epic_id, {:where=>"promoted_to_epic_id IS NOT NULL", :algorithm=>:concurrently})
   -> 0.0187s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- add_index(:issues, :promoted_to_epic_id, {:where=>"promoted_to_epic_id IS NOT NULL", :algorithm=>:concurrently})
   -> 0.2295s
-- execute("RESET ALL")
   -> 0.0004s
== 20191026120112 AddPromotedToEpicToIssuesIndex: migrated (0.8749s) ==========

When adding foreign keys to existing tables:

  • Included a migration to remove orphaned rows in the source table before adding the foreign key
  • Removed any instances of dependent: ... that may no longer be necessary

Related to #9898 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports