177463007b
These migrations do the following: - Adds a new `issue_id` column to `versions`. This fixes an n+1 problem when loading versions for an issue in GraphQL as AR can now load from cache - Change the unique restraint on versions.sha to be scoped to `issue_id` as in order to import version data, we need to allow duplicate `sha` values for versions - Update all versions with an `issue_id` https://gitlab.com/gitlab-org/gitlab-ee/issues/11090
13 lines
308 B
Ruby
13 lines
308 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddIssueIdToVersions < ActiveRecord::Migration[5.2]
|
|
DOWNTIME = false
|
|
|
|
def up
|
|
add_reference :design_management_versions, :issue, index: true, foreign_key: { on_delete: :cascade }
|
|
end
|
|
|
|
def down
|
|
remove_reference :design_management_versions, :issue
|
|
end
|
|
end
|