Convert RepositoryTypeCondition to store SCMTool ID instead of Tool PK.

Review Request #12336 — Created June 3, 2022 and submitted — Latest diff uploaded


Review Board


One of the last places where we were using the old Tool model was the
"Repository Type" condition for integration configurations. This used
the BaseConditionModelMultipleChoice to show a multiple choice field
with the various registered repository types. This meant that the form
field was populated using the contents of the Tool table, and selected
values were stored as the primary keys of the selected Tool instances.

This change makes it so the RepositoryTypeChoice instead loads its
values from the new SCMTools registry, using the SCMTool ID as the key.
In order to handle any existing integration configurations, a new stage
has been added to the upgrade to look through existing integration
configurations and update them.

  • Created and edited integration configurations using various usage of
    the "Repository Type" choice. Saw that everything was loaded from and
    saved to the database correctly.
  • Created several integration configurations using the "Repository Type"
    choice and then ran the upgrade. Saw that old lists of integers
    (Tool PKs) were updated to be lists of strings corresponding to the
    correct SCMTool IDs.
  • Ran unit tests.