Clarify database constraints for NOT NULL
In https://gitlab.com/gitlab-org/gitlab-ce/issues/66127#note_216306450, @sean_carroll brings up the question, "At GitLab do we always expect a presence validation to be backed by a db NOT NULL
?
I think the answer should be yes, but we probably have inconsistencies in our database at the moment. It would be good to document our policy and why, as well as any other database constraints (e.g. require foreign key associations when possible, etc.).
While we're at it, it seems like the Polymorphic associations discussion should at least be linked to the SQL discussion?
- https://docs.gitlab.com/ee/development/sql.html
- https://docs.gitlab.com/ee/development/polymorphic_associations.html#polymorphic-associations
Can someone from @gl-database take this?