summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-02-23 14:35:24 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-02-23 14:35:24 +0000
commit7e662dc7cba5440ba21a0a928f035914c48bce37 (patch)
tree640c7b2e58593a8d108cde5b18245f99516502a0 /db/migrate
parenta77b40d45e2f474a3d2401125b7b89379a7a7dd5 (diff)
parent22d6f96cf982765fa9b957905248a573c6e3c498 (diff)
downloadgitlab-ce-7e662dc7cba5440ba21a0a928f035914c48bce37.tar.gz
Merge branch '26570-optimize-latest-pipeline-query' into 'master'
Optimize Ci::Pipeline.latest query Closes #26570 See merge request !9306
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb10
-rw-r--r--db/migrate/20170216141440_drop_index_for_builds_project_status.rb8
2 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb b/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb
new file mode 100644
index 00000000000..7b1e687977b
--- /dev/null
+++ b/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb
@@ -0,0 +1,10 @@
+class AddIndexForLatestSuccessfulPipeline < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def change
+ add_concurrent_index(:ci_commits, [:gl_project_id, :ref, :status])
+ end
+end
diff --git a/db/migrate/20170216141440_drop_index_for_builds_project_status.rb b/db/migrate/20170216141440_drop_index_for_builds_project_status.rb
new file mode 100644
index 00000000000..906711b9f3f
--- /dev/null
+++ b/db/migrate/20170216141440_drop_index_for_builds_project_status.rb
@@ -0,0 +1,8 @@
+class DropIndexForBuildsProjectStatus < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ def change
+ remove_index(:ci_commits, [:gl_project_id, :status])
+ end
+end