Skip to content

Define naming convention for custom database constraints

João Pereira requested to merge jdrpereira-master-patch-10784 into master

What does this MR do?

Up to recently, the only application relying on a database was GitLab Rails. With Rails, the most common option is to let the ORM pick the name for new database constraints whenever possible or let PostgreSQL use the defaults (if applicable).

Gitaly Praefect now has a PostgreSQL database, and the Container Registry is about to have one as well. Both are Go applications, and following our development guidelines, no Go application uses an ORM.

For this reason, and speaking about the registry, we found the need to come up with a naming convention for database constraints for better consistency and discoverability. For this reason, and because there are currently no guidelines around this in the database development docs, we started by using an internal naming convention for the registry.

After receiving feedback from @iroussos in regards to possible improvements for the naming conventions (container-registry!407 (comment 443083456)), we decided to create this MR to discuss them and propose their addition to the database development docs, as they might be useful for GitLab Rails and other Go applications as well.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Merge request reports