Add once off job to “migrate” the Rule model

We can’t use an actual activerecord migration because everything is JSON serialised :(
This commit is contained in:
David Taylor 2017-08-01 17:12:21 +01:00
parent f3347b0a92
commit 6aa94fcb27
2 changed files with 12 additions and 1 deletions

View File

@ -47,4 +47,6 @@ require_relative "../services/manager"
require_relative "../jobs/regular/notify_chats"
require_relative "../../lib/discourse_chat/provider"
require_relative "../../lib/discourse_chat/provider"
require_relative "../jobs/onceoff/add_type_field"

View File

@ -0,0 +1,9 @@
module Jobs
class DiscourseChatAddTypeField < Jobs::Onceoff
def execute_onceoff(args)
DiscourseChat::Rule.find_each do |rule|
rule.save(validate: false)
end
end
end
end