Skip to content

DB and model changes for Sentry project selection dropdown

Reuben Pereira requested to merge 55199-schema-and-model-changes into master

What does this MR do?

Last release we had added an integration with Sentry where the user can add his Sentry API URL (ex: http://sentry.example.com/api/0/projects/organization-slug/project-slug/) and token and we display a list of Sentry issues/errors.

This issue is to make it easier for the user to set their Sentry API URL. In this issue, we aim to add a project selection dropdown, so that the user only has to enter his Sentry API host (ex: http://sentry.example.com) and token, then we populate the dropdown with a list of Sentry Organizations and Sentry Projects that the user has access to, and they can choose the project whose issues they want us to display.

This MR contains the DB and model changes for the issue to create a sentry project selection dropdown.

This MR adds new columns in project_error_tracking_settings table for project_name and organization_name. These names are required to display in the project selection dropdown.
There is no migration for existing integrations since the project_name and organization_name can be obtained from the api_url (http://sentry_host.com/api/0/projects/#{organization_slug}/#{project_slug}). The names are derived from the corresponding slugs. This has the benefit of avoiding a data migration.

  1. api_url is always NULL or contains the full API URL of a project.

  2. organization_slug and project_slug are NOT in separate columns, we always extract them from the URL.

  3. When we have project_name and organization_name from the Sentry API, we use those, otherwise we prettify the slugs we extracted in step 2.

When project_error_tracking_setting is exported, the token is excluded. This means that when the project_error_tracking_setting is imported, it cannot be immediately enabled since the token will be missing. For the above reason, the default value of the enabled column is changed to false.

null => false for api_url column has been changed to allow nulls since api_url should be allowed to be empty when enabled is false.

What are the relevant issue numbers?

#55199 (closed)

Does this MR meet the acceptance criteria?

Edited by Reuben Pereira

Merge request reports