Skip to content

Backfill relative positions on designs

Markus Koller requested to merge 221167-background-migration into master

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).

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

Availability and Testing

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

Merge request reports