Commit 9ba66b01 authored by Magdalena Frankiewicz's avatar Magdalena Frankiewicz

Remove not_null constraint and default for public_email

to make it uniform with other secondary emails
Change API to return nil for public_email

Changelog: changed
parent e21c54e1
# 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
fcee17f25ad3a8b6fb56c23b72978f4a6952200264d285b9e3df4b5e7733e8f6
\ No newline at end of file
......@@ -20153,7 +20153,7 @@ CREATE TABLE users (
encrypted_otp_secret_salt character varying,
otp_required_for_login boolean DEFAULT false NOT NULL,
otp_backup_codes text,
public_email character varying DEFAULT ''::character varying NOT NULL,
public_email character varying,
dashboard integer DEFAULT 0,
project_view integer DEFAULT 0,
consumed_timestep integer,
......@@ -498,7 +498,7 @@ RSpec.describe API::Members do
end
context 'when members have no public_email' do
it { is_expected.to include(a_hash_including('email' => '')) }
it { is_expected.to include(a_hash_including('email' => nil)) }
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment