Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20211018123316_remove_not_null_constraint_and_default_for_public_email.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
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