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

class AddAuthorToCiSubscriptionsProjects < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  INDEX_NAME = 'index_ci_subscriptions_projects_author_id'

  def up
    unless column_exists?(:ci_subscriptions_projects, :author_id)
      add_column :ci_subscriptions_projects, :author_id, :bigint
    end

    add_concurrent_index :ci_subscriptions_projects, :author_id, name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :ci_subscriptions_projects, INDEX_NAME
    remove_column :ci_subscriptions_projects, :author_id
  end
end