summaryrefslogtreecommitdiff
path: root/db/post_migrate/20230201082038_drop_web_hook_calls_high_column.rb
blob: 7f90b3293d8fc68e8be55a0e8497d4bbb79e5db7 (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 DropWebHookCallsHighColumn < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  def up
    with_lock_retries do
      if column_exists?(:plan_limits, :web_hook_calls_high) # rubocop:disable Style/IfUnlessModifier
        remove_column :plan_limits, :web_hook_calls_high
      end
    end
  end

  def down
    with_lock_retries do
      unless column_exists?(:plan_limits, :web_hook_calls_high)
        # rubocop:disable Migration/SchemaAdditionMethodsNoPost
        add_column :plan_limits, :web_hook_calls_high, :integer, default: 0
        # rubocop:enable Migration/SchemaAdditionMethodsNoPost
      end
    end
  end
end