mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 01:35:34 +08:00
Change scope of linked repository unique index for external_id to repositories and columns [SCI-9817] (#6754)
This commit is contained in:
parent
feeb350114
commit
0a64f1f4bb
2 changed files with 16 additions and 11 deletions
|
@ -9,26 +9,31 @@ class AddExternalIdToRepositoryColumnItems < ActiveRecord::Migration[6.1]
|
|||
add_column :repository_list_items, :external_id, :string, null: true
|
||||
add_column :repository_checklist_items, :external_id, :string, null: true
|
||||
add_index :repository_list_items,
|
||||
:external_id,
|
||||
%i(repository_column_id external_id),
|
||||
unique: true,
|
||||
name: 'unique_index_repository_list_items_on_external_id'
|
||||
add_index :repository_checklist_items,
|
||||
:external_id,
|
||||
%i(repository_column_id external_id),
|
||||
unique: true,
|
||||
name: 'unique_index_repository_checklist_items_on_external_id'
|
||||
add_gin_index_without_tags(:repository_list_items, :external_id)
|
||||
add_gin_index_without_tags(:repository_checklist_items, :external_id)
|
||||
|
||||
remove_index :repository_rows, :external_id, unique: true, name: 'unique_index_repository_rows_on_external_id'
|
||||
add_index :repository_rows,
|
||||
%i(repository_id external_id),
|
||||
unique: true,
|
||||
name: 'unique_index_repository_rows_on_external_id'
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :repository_rows, name: 'unique_index_repository_rows_on_external_id'
|
||||
add_index :repository_rows, :external_id, unique: true, name: 'unique_index_repository_rows_on_external_id'
|
||||
|
||||
remove_index :repository_rows, name: 'index_repository_checklist_items_on_external_id'
|
||||
remove_index :repository_rows, name: 'index_repository_list_items_on_external_id'
|
||||
remove_index :repository_checklist_items,
|
||||
:external_id,
|
||||
name: 'unique_index_repository_checklist_items_on_external_id'
|
||||
remove_index :repository_list_items,
|
||||
:external_id,
|
||||
name: 'unique_index_repository_list_items_on_external_id'
|
||||
remove_index :repository_checklist_items, name: 'unique_index_repository_checklist_items_on_external_id'
|
||||
remove_index :repository_list_items, name: 'unique_index_repository_list_items_on_external_id'
|
||||
remove_column :repository_checklist_items, :external_id, :string, null: true
|
||||
remove_column :repository_list_items, :external_id, :string, null: true
|
||||
end
|
||||
|
|
|
@ -661,8 +661,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_11_07_163821) do
|
|||
t.index "trim_html_tags((data)::text) gin_trgm_ops", name: "index_repository_checklist_items_on_data", using: :gin
|
||||
t.index "trim_html_tags((external_id)::text) gin_trgm_ops", name: "index_repository_checklist_items_on_external_id", using: :gin
|
||||
t.index ["created_by_id"], name: "index_repository_checklist_items_on_created_by_id"
|
||||
t.index ["external_id"], name: "unique_index_repository_checklist_items_on_external_id", unique: true
|
||||
t.index ["last_modified_by_id"], name: "index_repository_checklist_items_on_last_modified_by_id"
|
||||
t.index ["repository_column_id", "external_id"], name: "unique_index_repository_checklist_items_on_external_id", unique: true
|
||||
t.index ["repository_column_id"], name: "index_repository_checklist_items_on_repository_column_id"
|
||||
end
|
||||
|
||||
|
@ -757,8 +757,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_11_07_163821) do
|
|||
t.index "trim_html_tags((external_id)::text) gin_trgm_ops", name: "index_repository_list_items_on_external_id", using: :gin
|
||||
t.index "trim_html_tags(data) gin_trgm_ops", name: "index_repository_list_items_on_data", using: :gin
|
||||
t.index ["created_by_id"], name: "index_repository_list_items_on_created_by_id"
|
||||
t.index ["external_id"], name: "unique_index_repository_list_items_on_external_id", unique: true
|
||||
t.index ["last_modified_by_id"], name: "index_repository_list_items_on_last_modified_by_id"
|
||||
t.index ["repository_column_id", "external_id"], name: "unique_index_repository_list_items_on_external_id", unique: true
|
||||
t.index ["repository_column_id"], name: "index_repository_list_items_on_repository_column_id"
|
||||
end
|
||||
|
||||
|
@ -807,7 +807,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_11_07_163821) do
|
|||
t.index "trim_html_tags((name)::text) gin_trgm_ops", name: "index_repository_rows_on_name", using: :gin
|
||||
t.index ["archived"], name: "index_repository_rows_on_archived"
|
||||
t.index ["archived_by_id"], name: "index_repository_rows_on_archived_by_id"
|
||||
t.index ["external_id"], name: "unique_index_repository_rows_on_external_id", unique: true
|
||||
t.index ["repository_id", "external_id"], name: "unique_index_repository_rows_on_external_id", unique: true
|
||||
t.index ["repository_id"], name: "index_repository_rows_on_repository_id"
|
||||
t.index ["restored_by_id"], name: "index_repository_rows_on_restored_by_id"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue