Add approval_policy_rule_id to approval rules and related tables
What does this MR do and why?
This MR adds approval_policy_rule_id
column to tables related to approval rules. Security::ApprovalPolicyRule
replaces Security::ScanResultPolicyRead
in the future. The foreign key and index will be created synchronously with !155256 (merged) after this MR is merged.
Migration output
main: == [advisory_lock_connection] object_id: 128820, pg_backend_pid: 19770
main: == 20240604081941 AddApprovalPolicyRuleIdToApprovalGroupRules: migrating ======
main: -- add_column(:approval_group_rules, :approval_policy_rule_id, :bigint)
main: -> 0.0108s
main: == 20240604081941 AddApprovalPolicyRuleIdToApprovalGroupRules: migrated (0.0561s)
main: == [advisory_lock_connection] object_id: 128820, pg_backend_pid: 19770
main: == [advisory_lock_connection] object_id: 129240, pg_backend_pid: 19775
main: == 20240604082005 AddApprovalPolicyRuleIdToApprovalProjectRules: migrating ====
main: -- add_column(:approval_project_rules, :approval_policy_rule_id, :bigint)
main: -> 0.0017s
main: == 20240604082005 AddApprovalPolicyRuleIdToApprovalProjectRules: migrated (0.0087s)
main: == [advisory_lock_connection] object_id: 129240, pg_backend_pid: 19775
main: == [advisory_lock_connection] object_id: 130100, pg_backend_pid: 19781
main: == 20240604082023 AddApprovalPolicyRuleIdToApprovalMergeRequestRules: migrating
main: -- add_column(:approval_merge_request_rules, :approval_policy_rule_id, :bigint)
main: -> 0.0013s
main: == 20240604082023 AddApprovalPolicyRuleIdToApprovalMergeRequestRules: migrated (0.0058s)
main: == [advisory_lock_connection] object_id: 130100, pg_backend_pid: 19781
main: == [advisory_lock_connection] object_id: 130960, pg_backend_pid: 19786
main: == 20240604082113 AddApprovalPolicyRuleIdToSoftwareLicensePolicies: migrating =
main: -- add_column(:software_license_policies, :approval_policy_rule_id, :bigint)
main: -> 0.0017s
main: == 20240604082113 AddApprovalPolicyRuleIdToSoftwareLicensePolicies: migrated (0.0068s)
main: == [advisory_lock_connection] object_id: 130960, pg_backend_pid: 19786
main: == [advisory_lock_connection] object_id: 131820, pg_backend_pid: 19791
main: == 20240604082344 AddApprovalPolicyRuleIdToScanResultPolicyViolations: migrating
main: -- add_column(:scan_result_policy_violations, :approval_policy_rule_id, :bigint)
main: -> 0.0013s
main: == 20240604082344 AddApprovalPolicyRuleIdToScanResultPolicyViolations: migrated (0.0060s)
main: == [advisory_lock_connection] object_id: 131820, pg_backend_pid: 19791
main: == [advisory_lock_connection] object_id: 132680, pg_backend_pid: 19798
main: == 20240604082543 PrepareAsyncIndexPolicyRuleIdOnApprovalGroupRules: migrating
main: -- index_exists?(:approval_group_rules, :approval_policy_rule_id, {:name=>"index_approval_group_rules_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0073s
main: -- add_index_options(:approval_group_rules, :approval_policy_rule_id, {:name=>"index_approval_group_rules_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0007s
main: == 20240604082543 PrepareAsyncIndexPolicyRuleIdOnApprovalGroupRules: migrated (0.0903s)
main: == [advisory_lock_connection] object_id: 132680, pg_backend_pid: 19798
main: == [advisory_lock_connection] object_id: 133620, pg_backend_pid: 19803
main: == 20240604082611 PrepareAsyncIndexPolicyRuleIdOnApprovalProjectRules: migrating
main: -- index_exists?(:approval_project_rules, :approval_policy_rule_id, {:name=>"index_approval_project_rules_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0117s
main: -- add_index_options(:approval_project_rules, :approval_policy_rule_id, {:name=>"index_approval_project_rules_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0003s
main: == 20240604082611 PrepareAsyncIndexPolicyRuleIdOnApprovalProjectRules: migrated (0.0254s)
main: == [advisory_lock_connection] object_id: 133620, pg_backend_pid: 19803
main: == [advisory_lock_connection] object_id: 154040, pg_backend_pid: 19808
main: == 20240604082631 PrepareAsyncIndexPolicyRuleIdOnApprovalMergeRequestRules: migrating
main: -- index_exists?(:approval_merge_request_rules, :approval_policy_rule_id, {:name=>"index_approval_merge_request_rules_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0264s
main: -- add_index_options(:approval_merge_request_rules, :approval_policy_rule_id, {:name=>"index_approval_merge_request_rules_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0003s
main: == 20240604082631 PrepareAsyncIndexPolicyRuleIdOnApprovalMergeRequestRules: migrated (0.0494s)
main: == [advisory_lock_connection] object_id: 154040, pg_backend_pid: 19808
main: == [advisory_lock_connection] object_id: 177680, pg_backend_pid: 19813
main: == 20240604082712 PrepareAsyncIndexPolicyRuleIdOnScanResultPolicyViolations: migrating
main: -- index_exists?(:scan_result_policy_violations, :approval_policy_rule_id, {:name=>"index_scan_result_policy_violations_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0036s
main: -- add_index_options(:scan_result_policy_violations, :approval_policy_rule_id, {:name=>"index_scan_result_policy_violations_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0002s
main: == 20240604082712 PrepareAsyncIndexPolicyRuleIdOnScanResultPolicyViolations: migrated (0.0152s)
main: == [advisory_lock_connection] object_id: 177680, pg_backend_pid: 19813
main: == [advisory_lock_connection] object_id: 205480, pg_backend_pid: 19818
main: == 20240604082747 PrepareAsyncIndexPolicyRuleIdOnSoftwareLicensePolicies: migrating
main: -- index_exists?(:software_license_policies, :approval_policy_rule_id, {:name=>"index_software_license_policies_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0068s
main: -- add_index_options(:software_license_policies, :approval_policy_rule_id, {:name=>"index_software_license_policies_on_approval_policy_rule_id", :algorithm=>:concurrently})
main: -> 0.0010s
main: == 20240604082747 PrepareAsyncIndexPolicyRuleIdOnSoftwareLicensePolicies: migrated (0.0265s)
main: == [advisory_lock_connection] object_id: 205480, pg_backend_pid: 19818
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.
Addresses #416260 (closed)
Edited by Sashi Kumar Kumaresan