Skip to content

Add issue_id to epics

Nicolas Dular requested to merge nd/add-issue-id-to-epics into master

What does this MR do and why?

With the migration of epics to work items we will move epics to the issues table. To still keep a reference once an epic is moved, we have the issue_id now as part of the epics table.

Issue: #434528 (closed)

Migrate
main: == [advisory_lock_connection] object_id: 183000, pg_backend_pid: 83761
main: == 20231214095546 AddIssueIdToEpics: migrating ================================
main: -- add_column(:epics, :issue_id, :int, {:if_not_exists=>true})
main:    -> 0.1288s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- execute("ALTER TABLE epics ADD CONSTRAINT fk_893ee302e5 FOREIGN KEY (issue_id) REFERENCES issues (id) ON DELETE CASCADE NOT VALID;")
main:    -> 0.0029s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- execute("ALTER TABLE epics VALIDATE CONSTRAINT fk_893ee302e5;")
main:    -> 0.0107s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0005s
main: -- index_exists?(:epics, :issue_id, {:unique=>true, :name=>"index_unique_epics_on_issue_id", :algorithm=>:concurrently})
main:    -> 0.0048s
main: -- add_index(:epics, :issue_id, {:unique=>true, :name=>"index_unique_epics_on_issue_id", :algorithm=>:concurrently})
main:    -> 0.0019s
main: == 20231214095546 AddIssueIdToEpics: migrated (0.1871s) =======================
Rollback
r db:rollback:main
main: == [advisory_lock_connection] object_id: 182660, pg_backend_pid: 43601
main: == 20231214095546 AddIssueIdToEpics: reverting ================================
main: -- remove_column(:epics, :issue_id)
main:    -> 0.0023s
main: == 20231214095546 AddIssueIdToEpics: reverted (0.0053s) =======================

main: == [advisory_lock_connection] object_id: 182660, pg_backend_pid: 43601

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nicolas Dular

Merge request reports

Loading