22 lines
395 B
Ruby
22 lines
395 B
Ruby
class SetEmailForNotes < ActiveRecord::DataMigration
|
|
def up
|
|
say "Setting #email for Notes..."
|
|
|
|
Note.find_each do |note|
|
|
if note.user.present? && note.user.email.present?
|
|
note.update_column(:email, note.user.email)
|
|
end
|
|
end
|
|
|
|
say "Done."
|
|
end
|
|
|
|
def down
|
|
say "Unsetting #email for Notes..."
|
|
|
|
Note.update_all(email: nil)
|
|
|
|
say "Done."
|
|
end
|
|
end
|