Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20170526185602_add_stage_id_to_ci_builds.rb')
-rw-r--r--db/migrate/20170526185602_add_stage_id_to_ci_builds.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20170526185602_add_stage_id_to_ci_builds.rb b/db/migrate/20170526185602_add_stage_id_to_ci_builds.rb
new file mode 100644
index 00000000000..d5675d5828b
--- /dev/null
+++ b/db/migrate/20170526185602_add_stage_id_to_ci_builds.rb
@@ -0,0 +1,21 @@
+class AddStageIdToCiBuilds < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_column :ci_builds, :stage_id, :integer
+
+ add_concurrent_foreign_key :ci_builds, :ci_stages, column: :stage_id, on_delete: :cascade
+ add_concurrent_index :ci_builds, :stage_id
+ end
+
+ def down
+ remove_foreign_key :ci_builds, column: :stage_id
+ remove_concurrent_index :ci_builds, :stage_id
+
+ remove_column :ci_builds, :stage_id, :integer
+ end
+end