summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210901044237_events_bigint_conversion_remove_triggers.rb
blob: bfe3af2efa877d8b5f998da97897b1da8bf9639c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

class EventsBigintConversionRemoveTriggers < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  TABLE_NAME = :events
  TRIGGER_NAME = :trigger_69523443cc10

  # rubocop:disable Migration/WithLockRetriesDisallowedMethod
  def up
    check_trigger_permissions!(TABLE_NAME)

    with_lock_retries do
      remove_rename_triggers(TABLE_NAME, TRIGGER_NAME)
    end
  end

  def down
    check_trigger_permissions!(TABLE_NAME)

    with_lock_retries do
      install_rename_triggers(TABLE_NAME, :id, :id_convert_to_bigint, trigger_name: TRIGGER_NAME)
    end
  end
  # rubocop:enable Migration/WithLockRetriesDisallowedMethod
end