Add index to routes table on lower path for postgresql

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2016-12-12 16:30:24 +02:00
parent db9e1635d0
commit 211f019382
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
2 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,22 @@
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddLowerPathIndexToRoutes < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
return unless Gitlab::Database.postgresql?
execute 'CREATE INDEX CONCURRENTLY index_on_routes_lower_path ON routes (LOWER(path));'
end
def down
return unless Gitlab::Database.postgresql?
remove_index :routes, name: :index_on_routes_lower_path
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161202152035) do
ActiveRecord::Schema.define(version: 20161212142807) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"