summaryrefslogtreecommitdiff
path: root/db/post_migrate/20211018123316_remove_not_null_constraint_and_default_for_public_email.rb
blob: 72a5970b6d750974a4c3f388e72f4d14bf13b64e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

class RemoveNotNullConstraintAndDefaultForPublicEmail < Gitlab::Database::Migration[1.0]
  enable_lock_retries!

  def up
    change_column_null :users, :public_email, true
    change_column_default :users, :public_email, from: '', to: nil
  end

  def down
    # There may now be nulls in the table, so we cannot re-add the constraint here.
    change_column_default :users, :public_email, from: nil, to: ''
  end
end