Skip to content

Clean up schema for table issues

From https://gitlab.com/gitlab-com/infrastructure/issues/1709:

  • Wrong data type: deleted_at should be timestamptz
  • Wrong data type: closed_at should be timestamptz
  • Missing constraint: confidential NOT NULL (73 entries violate this rule)
  • Missing FK: assignee_id -> users (10153 entries violate this rule)
    • Column will be dropped, assignees are now in issue_assignees
  • Missing FK: author_id -> users (493488 entries violate this rule)
    • Already present
  • Missing FK: milestone_id -> milestones (139558 entries violate this rule)
  • Missing FK: updated_by_id -> users (6739 entries violate this rule)
  • Missing FK: project_id -> project (985149 entries violate this rule)
    • Already present
  • Missing FK: moved_to_id -> project (?)
  • Duplicate data: state could be enum/int, save 17MB
    • The state_machine Gem doesn't seem to support Rails enums (or other non string values) for state columns
  • Unused field: branch_name is always NULL
  • Index on boolean field: confidential: https://gitlab.com/gitlab-org/gitlab-ce/issues/39851
  • Index on low-cardinality field: state: https://gitlab.com/gitlab-org/gitlab-ce/issues/39852
  • Index on highly-NULL field: due_date (remove or replace with partial WHERE due_date IS NOT NULL index)
Edited by Yorick Peterse