diff --git a/db/migrate/20200211060234_migrate_join_course_message.rb b/db/migrate/20200211060234_migrate_join_course_message.rb new file mode 100644 index 000000000..e50b57493 --- /dev/null +++ b/db/migrate/20200211060234_migrate_join_course_message.rb @@ -0,0 +1,10 @@ +class MigrateJoinCourseMessage < ActiveRecord::Migration[5.2] + def change + Tiding.where(container_type: "JoinCourse", status: 0).find_each do |tiding| + unless CourseMessage.where(course_message_id: tiding.trigger_user_id, course_id: tiding.container_id, + course_message_type: "JoinCourseRequest", status: 0).exists? + tiding.update!(status: 1) + end + end + end +end