summaryrefslogtreecommitdiff
path: root/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb
blob: a8bb91cf6cf68aafefdece7461202ea943fb62cb (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 FixNotNullCheckConstraintInconsistency < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    table = :application_settings

    %i(container_registry_vendor container_registry_version).each do |column|
      change_column_null table, column, false
      remove_not_null_constraint(table, column) if check_not_null_constraint_exists?(table, column)
    end
  end

  def down
    # No-op: for regular systems without the inconsistency, #up is a no-op, too
  end
end