gitlab-org--gitlab-foss/db/post_migrate/20170211073944_disable_invalid_service_templates.rb
2017-02-14 15:44:13 -02:00

15 lines
354 B
Ruby

class DisableInvalidServiceTemplates < ActiveRecord::Migration
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