Add default value for merge_requests_author_approval
requested to merge 324087-change-default-value-to-merge_requests_author_approval-on-projects into master
What does this MR do?
merge_requests_author_approval
is a legacy boolean attribute that allows nil
values (and thus the ever wonderful tri-state boolean situation...)
This MR seeks to correct this by
-
adding a default value of false
-
handling nil
in attribute accessors -
adding aNOT NULL
constraint via a post migration
Docs on adding NOT NULL constraints
I don't believe we need to update existing records, since in this case we can modify/update existing accessor methods.
Related to #324087 (closed)
Migrations
Up
== 20210517221612 AddDefaultValueToMergeRequestsAuthorApprovalOnProjects: migrating
-- change_column_default(:projects, :merge_requests_author_approval, false)
-> 0.0075s
== 20210517221612 AddDefaultValueToMergeRequestsAuthorApprovalOnProjects: migrated (0.0116s)
Down
== 20210517221612 AddDefaultValueToMergeRequestsAuthorApprovalOnProjects: reverting
-- change_column_default(:projects, :merge_requests_author_approval, nil)
-> 0.0035s
== 20210517221612 AddDefaultValueToMergeRequestsAuthorApprovalOnProjects: reverted (0.0112s)
Edited by Kerri Miller