Ignore software_license_id in SoftwareLicensePolicy
What does this MR do and why?
Ignore software_license_id in SoftwareLicensePolicy, and updates the related validations.
As described in this issue, after the work we did to use the software_license catalog for SPDX licenses, the software_license_policies records will store either software_license_spdx_identifier or custom_software_license_id instead of software_license_id.
Database migrations
remove old constraint
Up
main: == 20250611121151 RemoveSoftwareLicenseConstraintFromSoftwareLicensePolicies: migrating
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute(" ALTER TABLE software_license_policies\n DROP CONSTRAINT IF EXISTS check_9ba23ae4c3\n")
main: -> 0.0027s
main: == 20250611121151 RemoveSoftwareLicenseConstraintFromSoftwareLicensePolicies: migrated (0.0284s)
Up
main: == [advisory_lock_connection] object_id: 137220, pg_backend_pid: 43963
main: == 20250613132434 AddSoftwareLicenseOrCustomLicenseConstraintToSoftwareLicensePolicies: migrating
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE software_license_policies\nADD CONSTRAINT check_6cb3facbb3\nCHECK ( num_nonnulls(custom_software_license_id, software_license_spdx_identifier) = 1 )\nNOT VALID;\n")
main: -> 0.0015s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0004s
main: -- execute("ALTER TABLE software_license_policies VALIDATE CONSTRAINT check_6cb3facbb3;")
main: -> 0.0016s
main: -- execute("RESET statement_timeout")
main: -> 0.0006s
main: == 20250613132434 AddSoftwareLicenseOrCustomLicenseConstraintToSoftwareLicensePolicies: migrated (0.0591s)
Down
main: == [advisory_lock_connection] object_id: 137020, pg_backend_pid: 56312
main: == 20250613132434 AddSoftwareLicenseOrCustomLicenseConstraintToSoftwareLicensePolicies: reverting
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute(" ALTER TABLE software_license_policies\n DROP CONSTRAINT IF EXISTS check_6cb3facbb3\n")
main: -> 0.0049s
main: == 20250613132434 AddSoftwareLicenseOrCustomLicenseConstraintToSoftwareLicensePolicies: reverted (0.1438s)
References
Related to: #524876 (closed), and #497969
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Marcos Rocha