20170525132202_create_pipeline_stages.rb 700 Bytes
Newer Older
1
# rubocop:disable Migration/Timestamps
2
class CreatePipelineStages < ActiveRecord::Migration[4.2]
3 4 5 6
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

7 8 9
  disable_ddl_transaction!

  def up
10 11 12
    create_table :ci_stages do |t|
      t.integer :project_id
      t.integer :pipeline_id
13
      t.timestamps null: true
14
      t.string :name
15
    end
16 17 18 19 20 21 22 23 24

    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
25 26
  end
end