Commit f1468a6b authored by Nick Thomas's avatar Nick Thomas

Merge branch 'missing-indexes-to-geo-event-log' into 'master'

Add missing indexes to geo_event_log table

See merge request !2836
parents c273f200 98de0935
---
title: Add missing indexes to geo_event_log table
merge_request: 2836
author:
type: other
class AddMissingIndexesToGeoEventLog < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
# MySQL automatically creates an index on a foreign-key constraint; PostgreSQL does not
if Gitlab::Database.postgresql?
add_concurrent_index :geo_event_log, :repositories_changed_event_id
add_concurrent_index :geo_event_log, :repository_deleted_event_id
add_concurrent_index :geo_event_log, :repository_renamed_event_id
end
end
def down
if Gitlab::Database.postgresql?
remove_concurrent_index :geo_event_log, :repositories_changed_event_id if index_exists? :geo_event_log, :repositories_changed_event_id
remove_concurrent_index :geo_event_log, :repository_deleted_event_id if index_exists? :geo_event_log, :repository_deleted_event_id
remove_concurrent_index :geo_event_log, :repository_renamed_event_id if index_exists? :geo_event_log, :repository_renamed_event_id
end
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170901071411) do ActiveRecord::Schema.define(version: 20170905202320) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -671,6 +671,9 @@ ActiveRecord::Schema.define(version: 20170901071411) do ...@@ -671,6 +671,9 @@ ActiveRecord::Schema.define(version: 20170901071411) do
t.integer "repositories_changed_event_id", limit: 8 t.integer "repositories_changed_event_id", limit: 8
end end
add_index "geo_event_log", ["repositories_changed_event_id"], name: "index_geo_event_log_on_repositories_changed_event_id", using: :btree
add_index "geo_event_log", ["repository_deleted_event_id"], name: "index_geo_event_log_on_repository_deleted_event_id", using: :btree
add_index "geo_event_log", ["repository_renamed_event_id"], name: "index_geo_event_log_on_repository_renamed_event_id", using: :btree
add_index "geo_event_log", ["repository_updated_event_id"], name: "index_geo_event_log_on_repository_updated_event_id", using: :btree add_index "geo_event_log", ["repository_updated_event_id"], name: "index_geo_event_log_on_repository_updated_event_id", using: :btree
create_table "geo_node_namespace_links", force: :cascade do |t| create_table "geo_node_namespace_links", 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