mirror of https://github.com/fspc/BikeShed-1.git
Ilya Konanykhin
8 years ago
3 changed files with 22 additions and 2 deletions
@ -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 |
Loading…
Reference in new issue