debian-mirror-gitlab/db/migrate/20170503185032_index_redirect_routes_path_for_like.rb

29 lines
881 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
2019-02-15 15:39:39 +05:30
class IndexRedirectRoutesPathForLike < ActiveRecord::Migration[4.2]
2017-08-17 22:00:37 +05:30
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
INDEX_NAME = 'index_redirect_routes_on_path_text_pattern_ops'
disable_ddl_transaction!
def up
return unless Gitlab::Database.postgresql?
unless index_exists?(:redirect_routes, :path, name: INDEX_NAME)
execute("CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON redirect_routes (path varchar_pattern_ops);")
end
end
def down
return unless Gitlab::Database.postgresql?
2017-09-10 17:25:29 +05:30
return unless index_exists?(:redirect_routes, :path, name: INDEX_NAME)
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
remove_concurrent_index_by_name(:redirect_routes, INDEX_NAME)
2017-08-17 22:00:37 +05:30
end
end