summaryrefslogtreecommitdiff
path: root/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-06-26 15:00:02 +0200
committerKamil Trzciński <ayufan@ayufan.eu>2018-06-26 15:00:09 +0200
commit05a6a71aef5f9aca56508df054c5ea35a748f30c (patch)
tree2a6691f8bc2217d73fc06795c4ece1d95eb2cdd1 /db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
parent7da7af3a22058a6fb4e22cbf2b659e910cc92d54 (diff)
downloadgitlab-ce-05a6a71aef5f9aca56508df054c5ea35a748f30c.tar.gz
Add index on deployable_type/id for deployments
Diffstat (limited to 'db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb')
-rw-r--r--db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb b/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
new file mode 100644
index 00000000000..a0e3a228f6c
--- /dev/null
+++ b/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
@@ -0,0 +1,18 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddIndexOnDeployableForDeployments < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :deployments, [:deployable_type, :deployable_id]
+ end
+
+ def down
+ remove_concurrent_index :deployments, [:deployable_type, :deployable_id]
+ end
+end