summaryrefslogtreecommitdiff
path: root/db/migrate/20161031171301_add_project_id_to_subscriptions.rb
blob: 8b1c10a124fd63ef1463fee88749e4f89f93935c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class AddProjectIdToSubscriptions < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

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

  def down
    remove_foreign_key :subscriptions, column: :project_id
    remove_column :subscriptions, :project_id
  end
end