scinote-web/db/migrate/20210618104853_add_code_index_to_experiments.rb

16 lines
404 B
Ruby
Raw Normal View History

2021-06-18 20:19:35 +08:00
# frozen_string_literal: true
class AddCodeIndexToExperiments < ActiveRecord::Migration[6.1]
2021-06-22 18:51:25 +08:00
def up
ActiveRecord::Base.connection.execute(
"CREATE INDEX index_experiments_on_experiment_code ON experiments using gin (('EX'::text || id) gin_trgm_ops);"
)
end
def down
ActiveRecord::Base.connection.execute(
'DROP INDEX index_experiments_on_experiment_code;'
)
end
end