BigW Consortium Gitlab

20161031171301_add_project_id_to_subscriptions.rb 462 Bytes
Newer Older
1 2 3 4 5 6 7
class AddProjectIdToSubscriptions < ActiveRecord::Migration
  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