Skip to content

Remove NOT NULL on policy_id for scan_result_policy_violations

Sashi Kumar Kumaresan requested to merge sk/464034-remove-not-null into master

What does this MR do and why?

This change updates scan_result_policy_violations table to remove the NOT NULL constraint on scan_result_policy_id as it will be replaced by approval_policy_rule_id as a part of Use database read model for merge request appr... (&9971)

Migration Output

Migrate Up

main: == [advisory_lock_connection] object_id: 128500, pg_backend_pid: 15855
main: == 20240704123140 RemoveScanResultPolicyViolationsPolicyIdNotNull: migrating ==
main: -- execute("ALTER TABLE scan_result_policy_violations ALTER COLUMN scan_result_policy_id DROP NOT NULL")
main:    -> 0.0022s
main: == 20240704123140 RemoveScanResultPolicyViolationsPolicyIdNotNull: migrated (0.0092s) 

main: == [advisory_lock_connection] object_id: 128500, pg_backend_pid: 15855

Migrate Down

main: == [advisory_lock_connection] object_id: 128500, pg_backend_pid: 15386
main: == 20240704123140 RemoveScanResultPolicyViolationsPolicyIdNotNull: reverting ==
main: -- execute("ALTER TABLE scan_result_policy_violations ALTER COLUMN scan_result_policy_id SET NOT NULL")
main:    -> 0.0025s
main: == 20240704123140 RemoveScanResultPolicyViolationsPolicyIdNotNull: reverted (0.0073s) 

main: == [advisory_lock_connection] object_id: 128500, pg_backend_pid: 15386

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 #464034

Edited by Sashi Kumar Kumaresan

Merge request reports