summaryrefslogtreecommitdiff
path: root/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-07-26 18:31:09 +0900
committerShinya Maeda <shinya@gitlab.com>2017-07-28 18:13:29 +0900
commit56418e85ac6b667d19495665860092ce4d74f55d (patch)
tree5741323fb221a1ccd30973fd399e50a47c94393c /db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb
parent190fae5f0cef11d68c7385be0c4013931796f958 (diff)
downloadgitlab-ce-56418e85ac6b667d19495665860092ce4d74f55d.tar.gz
init
Diffstat (limited to 'db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb')
-rw-r--r--db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb b/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb
new file mode 100644
index 00000000000..550b8a88f02
--- /dev/null
+++ b/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb
@@ -0,0 +1,15 @@
+class AddForeignKeyToCiPipelineVariables < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key(:ci_pipeline_variables, :ci_pipelines, column: :pipeline_id)
+ end
+
+ def down
+ remove_foreign_key(:ci_pipeline_variables, column: :pipeline_id)
+ end
+end