summaryrefslogtreecommitdiff
path: root/db/migrate/20181128123704_add_state_to_pool_repository.rb
blob: 4d4e56390dfde7a6772599896192d0b58cc8c4e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class AddStateToPoolRepository < ActiveRecord::Migration[5.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  # Given the table is empty, and the non concurrent methods are chosen so
  # the transactions don't have to be disabled
  # rubocop:disable Migration/AddConcurrentForeignKey
  # rubocop:disable Migration/AddIndex
  # rubocop:disable Migration/PreventStrings
  def change
    add_column(:pool_repositories, :state, :string, null: true)

    add_column :pool_repositories, :source_project_id, :integer
    add_index :pool_repositories, :source_project_id, unique: true
    add_foreign_key :pool_repositories, :projects, column: :source_project_id, on_delete: :nullify
  end
  # rubocop:enable Migration/PreventStrings
  # rubocop:enable Migration/AddIndex
  # rubocop:enable Migration/AddConcurrentForeignKey
end