Skip to content

Add closes_work_item column to merge_requests_closing_issues

Mario Celi requested to merge 454136-add-new-column into master

What does this MR do and why?

This new column wil be used to associate merge requests with issues table in a way that doesn't close the issues when the MR is merged. This is the first step on the implementation plan described in #454136

Defaulting to true on the new column as that is the current behavior. Every record on the table "closes" a work item. We introduce the column, so there is a way to set that to false so if the record exists in the table, it would not close the work item when the MR is merged

DB review

Migration output

UP

bin/rails db:migrate
main: == [advisory_lock_connection] object_id: 122420, pg_backend_pid: 43285
main: == 20240405172225 AddClosesWorkItemToMergeRequestsMergeRequestsClosingIssues: migrating
main: -- add_column(:merge_requests_closing_issues, :closes_work_item, :boolean, {:default=>true, :null=>false})
main:    -> 0.0013s
main: == 20240405172225 AddClosesWorkItemToMergeRequestsMergeRequestsClosingIssues: migrated (0.0039s)

main: == [advisory_lock_connection] object_id: 122420, pg_backend_pid: 43285
ci: == [advisory_lock_connection] object_id: 122720, pg_backend_pid: 43287
ci: == 20240405172225 AddClosesWorkItemToMergeRequestsMergeRequestsClosingIssues: migrating
ci: -- add_column(:merge_requests_closing_issues, :closes_work_item, :boolean, {:default=>true, :null=>false})
ci:    -> 0.0010s
ci: == 20240405172225 AddClosesWorkItemToMergeRequestsMergeRequestsClosingIssues: migrated (0.0067s)

ci: == [advisory_lock_connection] object_id: 122720, pg_backend_pid: 43287

DOWN

bin/rails db:rollback:main db:rollback:ci
main: == [advisory_lock_connection] object_id: 121940, pg_backend_pid: 42574
main: == 20240405172225 AddClosesWorkItemToMergeRequestsMergeRequestsClosingIssues: reverting
main: -- remove_column(:merge_requests_closing_issues, :closes_work_item, :boolean, {:default=>true, :null=>false})
main:    -> 0.0010s
main: == 20240405172225 AddClosesWorkItemToMergeRequestsMergeRequestsClosingIssues: reverted (0.0043s)

main: == [advisory_lock_connection] object_id: 121940, pg_backend_pid: 42574
ci: == [advisory_lock_connection] object_id: 122780, pg_backend_pid: 42829
ci: == 20240405172225 AddClosesWorkItemToMergeRequestsMergeRequestsClosingIssues: reverting
ci: -- remove_column(:merge_requests_closing_issues, :closes_work_item, :boolean, {:default=>true, :null=>false})
ci:    -> 0.0006s
ci: == 20240405172225 AddClosesWorkItemToMergeRequestsMergeRequestsClosingIssues: reverted (0.0081s)

ci: == [advisory_lock_connection] object_id: 122780, pg_backend_pid: 42829

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #454136

Edited by Mario Celi

Merge request reports