Clean up schema for table approver_groups
From https://gitlab.com/gitlab-com/infrastructure/issues/1709 (private to GitLab employees):
- Wrong data type: created_at should be timestamptz
- Wrong data type: updated_at should be timestamptz
- "Polymorphic" table prevents regular FKs, use triggers or change to independent columns or non-polymorphic tables
- Missing constraint: created_at NOT NULL
- Missing constraint: updated_at NOT NULL
We should replace target_type
and target_id
with merge_request_id
and project_id
, both with a foreign key to the right table. We also need to add a Rails validation that ensures only one of the two can be set for every row.
Edited by Yorick Peterse