Update multi column null constraint

What does this MR do and why?

This MR removes the software_license or custom_software_license constraint on software_license_policies. Without this constraint, it is possible to link software_license_policies to both software_license and custom_software_license.

This change is required to make the migration to the custom_software_license reversible.

Migration up

main: == 20241204180053 RemoveSoftwareLicenseExistenceConstraintToSoftwareLicensePolicies: 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.0013s

Migration down

main: == 20241204180053 RemoveSoftwareLicenseExistenceConstraintToSoftwareLicensePolicies: reverting 
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- execute("ALTER TABLE software_license_policies\nADD CONSTRAINT check_9ba23ae4c3\nCHECK ( num_nonnulls(custom_software_license_id, software_license_id) = 1 )\nNOT VALID;\n")
main:    -> 0.0033s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0004s
main: -- execute("ALTER TABLE software_license_policies VALIDATE CONSTRAINT check_9ba23ae4c3;")
main:    -> 0.0060s
main: -- execute("RESET statement_timeout")
main:    -> 0.0005s
main: == 20241204180053 RemoveSoftwareLicenseExistenceConstraintToSoftwareLicensePolicies: reverted (0.0548s) 

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Marcos Rocha

Merge request reports

Loading