summaryrefslogtreecommitdiff
path: root/db/migrate/20170525132202_create_pipeline_stages.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20170525132202_create_pipeline_stages.rb')
-rw-r--r--db/migrate/20170525132202_create_pipeline_stages.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/db/migrate/20170525132202_create_pipeline_stages.rb b/db/migrate/20170525132202_create_pipeline_stages.rb
new file mode 100644
index 00000000000..25656f2a2c2
--- /dev/null
+++ b/db/migrate/20170525132202_create_pipeline_stages.rb
@@ -0,0 +1,25 @@
+class CreatePipelineStages < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :ci_stages do |t|
+ t.integer :project_id
+ t.integer :pipeline_id
+ t.timestamps null: true
+ t.string :name
+ end
+
+ add_concurrent_foreign_key :ci_stages, :projects, column: :project_id, on_delete: :cascade
+ add_concurrent_foreign_key :ci_stages, :ci_pipelines, column: :pipeline_id, on_delete: :cascade
+ add_concurrent_index :ci_stages, :project_id
+ add_concurrent_index :ci_stages, :pipeline_id
+ end
+
+ def down
+ drop_table :ci_stages
+ end
+end