123456789101112131415161718192021222324252627282930313233343536 |
- class Issue2541FixNotificationEmailWithoutBody < ActiveRecord::Migration[5.1]
- def up
-
- return if !Setting.exists?(name: 'system_init_done')
-
-
- UserInfo.current_user_id = 1
-
- actions = %w[notification.email notification.sms]
- [::Job, ::Trigger].each do |model|
- model.all.each do |record|
- next if record.perform.blank?
- actions.each do |action|
- next if record.perform[action].blank?
- next if record.perform[action]['body'].present?
- record.perform[action]['body'] = '-'
- record.save!
- end
- end
- end
-
- scheduler = Scheduler.find_by(method: 'Job.run')
- return if !scheduler
- return if scheduler.active?
- scheduler.update!(active: true)
- end
- end
|