summaryrefslogtreecommitdiff
path: root/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb')
-rw-r--r--db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb14
1 files changed, 14 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..8a96a784c97
--- /dev/null
+++ b/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb
@@ -0,0 +1,14 @@
+class AddIndexForLatestSuccessfulPipeline < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:ci_commits, [:gl_project_id, :ref, :status])
+ end
+
+ def down
+ remove_index :ci_commits, [:gl_project_id, :ref, :status] if index_exists? :ci_commits, [:gl_project_id, :ref, :status]
+ end
+end