Populate timelogs.project_id
What does this MR do?
In order to complete !57322 (merged) we need to improve performance by adding project_id
to timelogs directly (instead of having to navigate via issues
/ merge_requests
).
In !60040 (merged) we added the column and configured it to populate for all new timelogs.
This merge request populates all historic entries.
We should follow this up with a final merge request to make the column non-nullable.
@sabrams has confirmed the merge request update should take around 4 minutes, so it is acceptable to run as a post-migration
Unfortunately, the issue update will likely take 20 minutes, so we need to run it as a background migration
Screenshots (strongly suggested)
lee@cc-gdk-2:~/gitlab-development-kit/gitlab$ bundle exec rake db:migrate:down VERSION=20210427212034 RAILS_ENV=development
== 20210427212034 ScheduleUpdateTimelogsProjectId: reverting ==================
== 20210427212034 ScheduleUpdateTimelogsProjectId: reverted (0.0000s) =========
lee@cc-gdk-2:~/gitlab-development-kit/gitlab$ bundle exec rake db:migrate:up VERSION=20210427212034 RAILS_ENV=development
== 20210427212034 ScheduleUpdateTimelogsProjectId: migrating ==================
-- Scheduled 1 UpdateTimelogsProjectId jobs with a maximum of 50000 records per batch and an interval of 120 seconds.
The migration is expected to take at least 120 seconds. Expect all jobs to have completed after 2021-04-29 08:23:08 UTC."
== 20210427212034 ScheduleUpdateTimelogsProjectId: migrated (0.0220s) =========
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. - [-] I have not included a changelog entry because _____.
-
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides - [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team