Fix partially migrated Jira integration records
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
In #334344 (closed) we noticed that Jira integration records in the services table don't always have an associated record in the jira_tracker_data table. A similar situation could exist with the issue_tracker_data and open_project_tracker_data associations.
These has_one associations use autosave: true and should always be created automatically with the parent record: https://gitlab.com/gitlab-org/gitlab/blob/fd37b3ee90062678909556806acc80c6eddbb49e/app/models/concerns/integrations/has_data_fields.rb#L46-48
We can see the problem on staging for example:
[ gstg ] production> Integrations::Jira.count
=> 1741740
[ gstg ] production> Integrations::JiraTrackerData.count
=> 1741715
We can also still see the original properties, apparently these were not cleared in the migration:
gitlabhq_production=> SELECT COUNT(*) FROM services WHERE type = 'JiraService' AND properties IS NOT NULL AND properties != '{}' AND properties != '';
count
-------
3829
(1 row)
Improvements
- Review and re-run the original data migration from !18639 (merged).
- We already had a second attempt in !24076 (merged).
- Remove the original
propertiesafter they've been migrated to separate records.