Removing training_providers rails model

What does this MR do and why?

Contributes to: #478629 (closed)

As part of the organizations work we need to entirely remove the data table security_training_providers. We have already created a static AR model to power this, but the GraphQL API and some relations still use the old table.

This MR removes that model from rails but does not remove the underlying table, that will need to happen in the next milestone.

In the last 4 weeks, we have seen 143 mutation calls to the GraphQL API which is very low. We can't discriminate between calls coming from the UI and programatic calls, but given how this is generally used I'd expect all of these calls to be through UI use. (note: I've tried looking for user agents and flags to indicate if the calls are coming from a user using the UI or a script, but user agents are blank and I can't find another flag to discriminate, if you know one, let me know!)

Breaking Changes

This changes the GID value returned from one GraphQL query and the GID parameter value for a GraphQL mutation. We assume that all use of this comes from navigating through the UI rather than programatic use (programatic use is possible, we just don't think it's likely at all). So while the GID is changing, it will not cause a break in any visible way to the user: the GIDs are retrieved on page load and then sent into the GraphQL Mutation, if needed.

The response from this query changes:

Query Previous Current
query getTrainingProviders {
  project(fullPath: "...") {
    securityTrainingProviders {
      id,
      name
    }
  }
}
{
  "data": {
    "project": {
      "securityTrainingProviders": [
        {
          "id": "gid://gitlab/Security::TrainingProvider/31",
          "name": "Kontra"
        }
      ]
    }
  }
}
{
  "data": {
    "project": {
      "securityTrainingProviders": [
        {
          "id": "gid://gitlab/Security::TrainingProvider/1",
          "name": "Kontra"
        }
      ]
    }
  }
}

The numerical ID of the GID changes. This also means that the mutation to update a security training provider also changes, where the providerId uses the GID returned by the above query.

mutation securityTrainingUpdate {
  securityTrainingUpdate(
    input: {
      projectPath: "...",
      providerId: "gid://gitlab/Security::TrainingProvider/1",
      isEnabled: false,
      isPrimary: false
    }
  )
}

In practice, the only risk here is if someone has hard-coded a mutation with an old value. In production when using the settings interface the correct values are retrieved before the mutation runs.

Edited by Ryan Wells

Merge request reports

Loading