blob: 8237c48b16de91e356eeac92abb13a995160031b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
class ExcludeNullsFromIndexOnNamespacesType < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index(:namespaces, :type, where: 'type is not null', name: 'index_namespaces_on_type_partial')
remove_concurrent_index_by_name(:namespaces, 'index_namespaces_on_type')
end
def down
add_concurrent_index(:namespaces, :type, name: 'index_namespaces_on_type')
remove_concurrent_index_by_name(:namespaces, 'index_namespaces_on_type_partial')
end
end
|