Commit 3fd1d417 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'tc-partial-index-for-namespaces-type-ee' into 'master'

Partial index for namespaces.type

See merge request gitlab-org/gitlab-ee!16571
parents fb515a18 405da4f5
---
title: Partial index for namespaces.type
merge_request: 32876
author:
type: performance
# 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
...@@ -2300,7 +2300,7 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do ...@@ -2300,7 +2300,7 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do
t.index ["runners_token_encrypted"], name: "index_namespaces_on_runners_token_encrypted", unique: true t.index ["runners_token_encrypted"], name: "index_namespaces_on_runners_token_encrypted", unique: true
t.index ["shared_runners_minutes_limit", "extra_shared_runners_minutes_limit"], name: "index_namespaces_on_shared_and_extra_runners_minutes_limit" t.index ["shared_runners_minutes_limit", "extra_shared_runners_minutes_limit"], name: "index_namespaces_on_shared_and_extra_runners_minutes_limit"
t.index ["trial_ends_on"], name: "index_namespaces_on_trial_ends_on", where: "(trial_ends_on IS NOT NULL)" t.index ["trial_ends_on"], name: "index_namespaces_on_trial_ends_on", where: "(trial_ends_on IS NOT NULL)"
t.index ["type"], name: "index_namespaces_on_type" t.index ["type"], name: "index_namespaces_on_type_partial", where: "(type IS NOT NULL)"
end end
create_table "note_diff_files", id: :serial, force: :cascade do |t| create_table "note_diff_files", id: :serial, force: :cascade do |t|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment