Your migration will work and will allow multiple null values (for the most database engines).
But your validation for the user class should look like below.
validates :email, uniqueness: true, allow_nil: true
Your migration will work and will allow multiple null values (for the most database engines).
But your validation for the user class should look like below.
validates :email, uniqueness: true, allow_nil: true