Clean up schema for table events

From https://gitlab.com/gitlab-com/infrastructure/issues/1709 (private to GitLab employees):

  • Missing FK: project_id -> projects (11256 entries violate this rule)
  • Missing constraint: author_id NOT NULL: https://gitlab.com/gitlab-org/gitlab-ce/issues/35586

The following will be taken care of by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12463:

  • Get rid of events.data once push events data has been moved to a separate table, since it does not appear to be used for other event types
  • Missing FK: author_id -> users (8763 entries violate this rule)
  • Missing constraint: action NOT NULL
  • Remove the column events.title as it appears to always be NULL
    • Confirmed that as of July 25th, 2017 this column is always NULL

Instead of using polymorphic types we should use separate columns for the different target types (diff_note_id, discussion_note_id, etc). This allows us to re-use existing functionality instead of having to write our own foreign key related code. The number of columns added is not that great after all.

Edited Aug 09, 2017 by Yorick Peterse
Assignee Loading
Time tracking Loading