Clean up schema for table labels
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
From https://gitlab.com/gitlab-com/infrastructure/issues/1709 (private to GitLab employees):
Wrong data type: created_at should be timestamptzWrong data type: updated_at should be timestamptz- Missing constraint: created_at NOT NULL
- Missing constraint: updated_at NOT NULL
- Missing constraint: type NOT NULL
-
Missing constraint: !(project_id IS NULL AND group_id IS NULL)Since we don't really have a nice way of duplicating validations between the DB and models we should just implement this as a Rails validation- "check_2d9a8c1bca" CHECK (num_nonnulls(group_id, organization_id, project_id) = 1) NOT VALID
-
Missing FK: project_id -> projects (35 entries violate this rule)- "fk_7de4989a69" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
- Wrong data type: color should be int, save 6 MB
- Duplicate data: type could be enum/int, save 12 MB
- Index on (type, project_id) likely could be removed, type is not very selective
- With the introduction of group labels this may no longer be the case
Edited by 🤖 GitLab Bot 🤖