debian-mirror-gitlab/db/post_migrate/20211018123316_remove_not_null_constraint_and_default_for_public_email.rb
2021-12-11 22:18:48 +05:30

16 lines
450 B
Ruby

# 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