parent
d667d82e5c
commit
4d2f30f39e
@ -0,0 +1,7 @@
|
|||||||
|
class MigrateDefalutToTiding < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
change_column_default :tidings, :status, from: nil, to: 0
|
||||||
|
|
||||||
|
Tiding.where(status: nil).update_all(status: 0)
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,9 @@
|
|||||||
|
class MigrateTidingStatus < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
Tiding.where(container_type: "JoinCourse", status: 0).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
|
Loading…
Reference in new issue