Add relative positioning on designs
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
-
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