summaryrefslogtreecommitdiff
path: root/db/post_migrate/20200608195222_set_lock_version_not_null_constraint.rb
blob: ec72053b3078a1dcc6da6b29500e592be1504883 (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 SetLockVersionNotNullConstraint < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  TABLES = %i(epics merge_requests issues ci_stages ci_builds ci_pipelines).freeze

  def up
    TABLES.each do |table|
      add_not_null_constraint table, :lock_version, validate: false
    end
  end

  def down
    TABLES.each do |table|
      remove_not_null_constraint table, :lock_version
    end
  end
end