Skip to content

Remove SoftwareLicensePolicies without ScanResultPolicy

What does this MR do and why?

This MR adds a post_deployment_migration to removes the SoftwareLicensePolicies without ScanResultPolicy.

This cleanup is one of the steps required for removal of License-Check feature as described in #397067 (closed).

Query

DELETE FROM software_license_policies
WHERE scan_result_policy_id IS NULL

Before Index

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/18057/commands/59909

Migrations

up

main: == 20230501165244 RemoveSoftwareLicensePoliciesWithoutScanResultPolicyId: migrating 
main: -- execute("DELETE FROM software_license_policies WHERE scan_result_policy_id IS NULL")
main:    -> 0.0027s
main: == 20230501165244 RemoveSoftwareLicensePoliciesWithoutScanResultPolicyId: migrated (0.0053s)

down

main: == 20230501165244 RemoveSoftwareLicensePoliciesWithoutScanResultPolicyId: reverting 
main: == 20230501165244 RemoveSoftwareLicensePoliciesWithoutScanResultPolicyId: reverted (0.0101s) 

Expected number of rows affected:

SELECT COUNT(*) FROM software_license_policies WHERE scan_result_policy_id IS NULL;
 count 
-------
 26847
(1 row)

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 Marcos Rocha

Merge request reports

Loading