summaryrefslogtreecommitdiff
path: root/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb
blob: 7f6cd6d5a78a670a5d0820b3ee881aaa97c8da57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class NamespacesProjectsPathLowerIndexes < ActiveRecord::Migration
  disable_ddl_transaction!

  def up
    return unless Gitlab::Database.postgresql?

    execute 'CREATE INDEX CONCURRENTLY index_on_namespaces_lower_path ON namespaces (LOWER(path));'
    execute 'CREATE INDEX CONCURRENTLY index_on_projects_lower_path ON projects (LOWER(path));'
  end

  def down
    return unless Gitlab::Database.postgresql?

    remove_index :namespaces, name: :index_on_namespaces_lower_path
    remove_index :projects, name: :index_on_projects_lower_path
  end
end