mirror of https://github.com/fspc/BikeShed-1.git
Jason Denney
8 years ago
committed by
GitHub
6 changed files with 51 additions and 7 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