Files
old-holivud2/db/data_migrations/20200424165527_assign_zoom_meetings_to_projects.rb
2020-05-31 22:38:19 +02:00

17 lines
428 B
Ruby

class AssignZoomMeetingsToProjects < ActiveRecord::DataMigration
def up
ZoomMeeting.find_each do |zm|
if zm.respond_to?(:broadcast_id) && zm.broadcast_id.present?
broadcast = Broadcast.find_by(id: zm.broadcast_id)
if broadcast.present?
zm.update_column(:project_id, broadcast.project_id)
end
end
end
end
def down
ZoomMeeting.update_all(project_id: nil)
end
end