summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 09:07:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 09:07:48 +0000
commit5bd24a54ef4ce3a38a860eb53b66d062c2382971 (patch)
tree5f5e65571dfcb2c62c27600ee7655dec4b44c923 /db
parent74673d04d25ffed35cbcf17cd42969bed0a4e705 (diff)
downloadgitlab-ce-5bd24a54ef4ce3a38a860eb53b66d062c2382971.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20191205060723_add_index_to_keys.rb17
-rw-r--r--db/schema.rb1
2 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20191205060723_add_index_to_keys.rb b/db/migrate/20191205060723_add_index_to_keys.rb
new file mode 100644
index 00000000000..8e8c725f62e
--- /dev/null
+++ b/db/migrate/20191205060723_add_index_to_keys.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToKeys < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :keys, :last_used_at, order: { last_used_at: 'DESC NULLS LAST' }
+ end
+
+ def down
+ remove_concurrent_index :keys, :last_used_at
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 870eb22e1f1..7b0ecce825c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -2217,6 +2217,7 @@ ActiveRecord::Schema.define(version: 2019_12_14_175727) do
t.index ["fingerprint"], name: "index_keys_on_fingerprint", unique: true
t.index ["fingerprint_sha256"], name: "index_keys_on_fingerprint_sha256"
t.index ["id", "type"], name: "index_on_deploy_keys_id_and_type_and_public", unique: true, where: "(public = true)"
+ t.index ["last_used_at"], name: "index_keys_on_last_used_at", order: "DESC NULLS LAST"
t.index ["user_id"], name: "index_keys_on_user_id"
end