Skip to content

Consolidate normalization of github user type field #1345

@begedin

Description

@begedin

Problem

The github user payload has a type field which can be "User", "Bot" or "Organization".

With "User" and "Bot", we normalize these values during conversion into "user" and "bot".

However, "Organization" remains capitalized and is not changed when inserting/updating into our database. Any case where where the type is being saved as "Organization" should be saved as "organization" (lowercased).

Subtasks

  • make switch in code so "Organization" is normalized into the lowercase "organization"
    • in lib/github/adapters/user.ex, the function transform_type/1 is likely the only culprit
  • change any tests affected by this
  • add an existing data migration, for staging and production, which changes "Organization" to "organization" on all user records of type "Organization"
from u in User, where [type: "Organization"]
|> Repo.update_all(set: [type: "organization"])

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions