2017-03-30 10:38:05 -04:00
|
|
|
# This is the same as DisableInvalidServiceTemplates. Later migrations may have
|
|
|
|
# inadventently enabled some invalid templates again.
|
|
|
|
#
|
2018-11-13 02:27:31 -05:00
|
|
|
class DisableInvalidServiceTemplates2 < ActiveRecord::Migration[4.2]
|
2017-03-30 10:38:05 -04:00
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
unless defined?(Service)
|
|
|
|
class Service < ActiveRecord::Base
|
|
|
|
self.inheritance_column = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def up
|
|
|
|
Service.where(template: true, active: true).each do |template|
|
|
|
|
template.update(active: false) unless template.valid?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|