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

20170525132202_create_pipeline_stages.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 25656f2a2c28f65d300d5e582d30a179ddfe4a00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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