Skip to content

Add relative positioning on designs

Markus Koller requested to merge 221167-model-changes into master

What does this MR do?

This adds relative positioning on the DesignManagement::Design model.

The order will only be used if the feature flag reorder_designs is enabled, but we still initialize a relative position for new designs even when the flag is disabled, to simplify the background migration which will be added in !37837 (merged).

Part of #221167 (closed).

Migrations

db/migrate/20200722091435_add_relative_position_to_design_management_designs.rb

$ rake db:migrate:up VERSION=20200722091435
== 20200722091435 AddRelativePositionToDesignManagementDesigns: migrating =====
-- add_column(:design_management_designs, :relative_position, :integer)
   -> 0.0009s
== 20200722091435 AddRelativePositionToDesignManagementDesigns: migrated (0.0009s)

$ rake db:migrate:down VERSION=20200722091435
== 20200722091435 AddRelativePositionToDesignManagementDesigns: reverting =====
-- remove_column(:design_management_designs, :relative_position, :integer)
   -> 0.0009s
== 20200722091435 AddRelativePositionToDesignManagementDesigns: reverted (0.0023s)

db/migrate/20200728174137_add_index_on_design_management_designs_issue_id_and_relative_position_and_id.rb

$ rake db:migrate:up VERSION=20200728174137                                                                           
== 20200728174137 AddIndexOnDesignManagementDesignsIssueIdAndRelativePositionAndId: migrating 
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:design_management_designs, [:issue_id, :relative_position, :id], {:name=>"index_design_management_designs_issue_id_relative_position_id", :algorithm=>:concurrently})
   -> 0.0030s
-- add_index(:design_management_designs, [:issue_id, :relative_position, :id], {:name=>"index_design_management_designs_issue_id_relative_position_id", :algorithm=>:concurrently})
   -> 0.0046s
== 20200728174137 AddIndexOnDesignManagementDesignsIssueIdAndRelativePositionAndId: migrated (0.0080s)

$ rake db:migrate:down VERSION=20200728174137
== 20200728174137 AddIndexOnDesignManagementDesignsIssueIdAndRelativePositionAndId: reverting 
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:design_management_designs, [:issue_id, :relative_position, :id], {:name=>"index_design_management_designs_issue_id_relative_position_id", :algorithm=>:concurrently})
   -> 0.0050s
-- remove_index(:design_management_designs, {:name=>"index_design_management_designs_issue_id_relative_position_id", :algorithm=>:concurrently, :column=>[:issu
e_id, :relative_position, :id]})
   -> 0.0037s
== 20200728174137 AddIndexOnDesignManagementDesignsIssueIdAndRelativePositionAndId: reverted (0.0093s)

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