scinote-web/db/migrate/20210715125349_add_repository_row_code_index.rb
artoscinote 5f9c04844f
Added prefixed IDs to repository rows (items) [SCI-5909] (#3441)
* Added prefixed IDs to repository rows (items) [SCI-5909]

* Fix prefixed id queries to work with joins, use subquery in repository search [SCI-5909]

* Fixed accessing repository_row parent code [SCI-5909]

* Better handling of repository_row code display [SCI-5909]

* Fix index warning for id prefixed models issue setting up project [SCI-5909]
2021-07-19 14:23:36 +02:00

15 lines
408 B
Ruby

# frozen_string_literal: true
class AddRepositoryRowCodeIndex < ActiveRecord::Migration[6.1]
def up
ActiveRecord::Base.connection.execute(
"CREATE INDEX index_repository_rows_on_repository_row_code ON "\
"repository_rows using gin (('IT'::text || id) gin_trgm_ops);"
)
end
def down
remove_index :repository_rows, name: 'index_repository_rows_on_repository_row_code'
end
end