20161031171301_add_project_id_to_subscriptions.rb 467 Bytes
Newer Older
1
class AddProjectIdToSubscriptions < ActiveRecord::Migration[4.2]
2 3 4 5 6 7
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    add_column :subscriptions, :project_id, :integer
8
    add_foreign_key :subscriptions, :projects, column: :project_id, on_delete: :cascade # rubocop: disable Migration/AddConcurrentForeignKey
9 10 11
  end

  def down
12
    remove_foreign_key :subscriptions, column: :project_id
13 14 15
    remove_column :subscriptions, :project_id
  end
end