Backfill relative positions on designs
What does this MR do?
This adds a background migration to backfill the relative_position
columns on the DesignManagement::Design
model, which was introduced in !37835 (merged).
-
Rebase and change merge target after !37835 (merged) is merged.
Part of #221167 (closed).
Migrations
$ rake db:migrate:up VERSION=20200724130639
== 20200724130639 BackfillDesignsRelativePosition: migrating ==================
== 20200724130639 BackfillDesignsRelativePosition: migrated (0.0166s) =========
$ rake db:migrate:down VERSION=20200724130639
== 20200724130639 BackfillDesignsRelativePosition: reverting ==================
== 20200724130639 BackfillDesignsRelativePosition: reverted (0.0000s) =========
Details on the background migration
- In !37835 (merged) we've introduced the
relative_position
column and are setting it for every newly created design. - The post migration queries all issues having designs, and bulk-queues background migrations for them.
- The feature flag can be enabled after all migrations have completed. If it's enabled before then, the ordering will be temporarily incorrect, but otherwise this won't cause any harm.
This means:
- We don't need to worry about newly created issues, or issues that previously didn't have designs but do now, since they will already have a relative position set.
- We don't need to do any clean up later.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] 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
Edited by Markus Koller