summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-04-24 10:57:26 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2017-04-24 10:57:26 +0000
commit770b2f5171e6e44a79b6a2f0cc60672909ce351d (patch)
tree48e7eb08c1de1c3f50546449873d6a4ff35388e9
parentc768026474b9dff9f6f988372e4eefb85b1d8be9 (diff)
parentc458b293593c9cdf364286fe4971c22c1e33fbf8 (diff)
downloadgitlab-ce-770b2f5171e6e44a79b6a2f0cc60672909ce351d.tar.gz
Merge branch 'add_index_on_ci_builds_updated_at' into 'master'
Add index on ci_builds.updated_at Closes #31251 See merge request !10870
-rw-r--r--changelogs/unreleased/add_index_on_ci_builds_updated_at.yml4
-rw-r--r--db/migrate/20170423064036_add_index_on_ci_builds_updated_at.rb19
-rw-r--r--db/schema.rb3
3 files changed, 25 insertions, 1 deletions
diff --git a/changelogs/unreleased/add_index_on_ci_builds_updated_at.yml b/changelogs/unreleased/add_index_on_ci_builds_updated_at.yml
new file mode 100644
index 00000000000..ede9b946a70
--- /dev/null
+++ b/changelogs/unreleased/add_index_on_ci_builds_updated_at.yml
@@ -0,0 +1,4 @@
+---
+title: Add index on ci_builds.updated_at
+merge_request: 10870
+author: blackst0ne
diff --git a/db/migrate/20170423064036_add_index_on_ci_builds_updated_at.rb b/db/migrate/20170423064036_add_index_on_ci_builds_updated_at.rb
new file mode 100644
index 00000000000..0bbb74ee05e
--- /dev/null
+++ b/db/migrate/20170423064036_add_index_on_ci_builds_updated_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 AddIndexOnCiBuildsUpdatedAt < 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_builds, :updated_at
+ end
+
+ def down
+ remove_concurrent_index :ci_builds, :updated_at if index_exists?(:ci_builds, :updated_at)
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 290d969d7de..7b13f2a98a1 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: 20170419001229) do
+ActiveRecord::Schema.define(version: 20170423064036) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -241,6 +241,7 @@ ActiveRecord::Schema.define(version: 20170419001229) do
add_index "ci_builds", ["status", "type", "runner_id"], name: "index_ci_builds_on_status_and_type_and_runner_id", using: :btree
add_index "ci_builds", ["status"], name: "index_ci_builds_on_status", using: :btree
add_index "ci_builds", ["token"], name: "index_ci_builds_on_token", unique: true, using: :btree
+ add_index "ci_builds", ["updated_at"], name: "index_ci_builds_on_updated_at", using: :btree
create_table "ci_pipelines", force: :cascade do |t|
t.string "ref"