mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 08:31:36 -04:00
Fix: user email should be null instead of empty string
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
class UserEmailCanBeNull < ActiveRecord::Migration
|
||||
def up
|
||||
change_table :users do |t|
|
||||
t.change :email, :string, default: nil, null: true
|
||||
end
|
||||
|
||||
User.where(email: '').update_all(email: nil)
|
||||
end
|
||||
|
||||
def down
|
||||
change_table :users do |t|
|
||||
t.change :email, :string, default: '', null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user