diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-04-28 11:54:12 +0000 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-04-28 12:52:02 +0000 |
commit | fc9f6c6db2ba196b4b0a5d061e9da443b7482373 (patch) | |
tree | bd109789c51905dced9f5d8d650ca9eb15e850b4 | |
parent | f886c6f7e66e356fc48d845df2ac62e2a3b0ed00 (diff) | |
download | gitlab-ce-fc9f6c6db2ba196b4b0a5d061e9da443b7482373.tar.gz |
Merge branch 'add_index_on_ci_runners_contacted_at' into 'master'
Add index on ci_runners.contacted_at
Closes #31229
See merge request !10876
-rw-r--r-- | changelogs/unreleased/add_index_on_ci_runners_contacted_at.yml | 4 | ||||
-rw-r--r-- | db/migrate/20170426181740_add_index_on_ci_runners_contacted_at.rb | 19 | ||||
-rw-r--r-- | db/schema.rb | 3 |
3 files changed, 25 insertions, 1 deletions
diff --git a/changelogs/unreleased/add_index_on_ci_runners_contacted_at.yml b/changelogs/unreleased/add_index_on_ci_runners_contacted_at.yml new file mode 100644 index 00000000000..10c3206c2ff --- /dev/null +++ b/changelogs/unreleased/add_index_on_ci_runners_contacted_at.yml @@ -0,0 +1,4 @@ +--- +title: Add index on ci_runners.contacted_at +merge_request: 10876 +author: blackst0ne diff --git a/db/migrate/20170426181740_add_index_on_ci_runners_contacted_at.rb b/db/migrate/20170426181740_add_index_on_ci_runners_contacted_at.rb new file mode 100644 index 00000000000..879825a1934 --- /dev/null +++ b/db/migrate/20170426181740_add_index_on_ci_runners_contacted_at.rb @@ -0,0 +1,19 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddIndexOnCiRunnersContactedAt < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_runners, :contacted_at + end + + def down + remove_concurrent_index :ci_runners, :contacted_at if index_exists?(:ci_runners, :contacted_at) + end +end diff --git a/db/schema.rb b/db/schema.rb index 3e656c77047..e818a8c03c9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170426175636) do +ActiveRecord::Schema.define(version: 20170426181740) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -291,6 +291,7 @@ ActiveRecord::Schema.define(version: 20170426175636) do t.boolean "locked", default: false, null: false end + add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree add_index "ci_runners", ["is_shared"], name: "index_ci_runners_on_is_shared", using: :btree add_index "ci_runners", ["locked"], name: "index_ci_runners_on_locked", using: :btree add_index "ci_runners", ["token"], name: "index_ci_runners_on_token", using: :btree |