Skip to content

Add constraints to services table

In https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/9176 we found that a few database constraints on the services table could have helped preventing the incident.

Service Templates and Project Services live in the same table. when template is true it is a service template and when project_id is not null, it is a project service. But a service should not be allowed to be both. Therefore a constraint to prevent that both columns are set would be useful.

There is another issue for uniqueness of service type by project_id or template #207385 (closed)

Edited by Andy Schoenen