Use postgres_foreign_keys view for constraint validations
The following discussion from !1350 (merged) should be addressed:
-
@stomlinson started a discussion: If we plan to do a lot more of these, we might benefit from the
postgres_foreign_keysview defined in the rails project:https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/structure.sql?ref_type=heads#L20731
It has a lot of nice features. It can check if the constraint is validated, look at partitioning relationships between keys, and deal with text names rather than using
::regclass.