gitlab-org--gitlab-foss/db/post_migrate/20170211073944_disable_invalid_service_templates.rb

14 lines
320 B
Ruby
Raw Normal View History

class DisableInvalidServiceTemplates < ActiveRecord::Migration[4.2]
2017-01-27 14:22:17 -05:00
DOWNTIME = false
class Service < ActiveRecord::Base
self.inheritance_column = nil
2017-01-27 14:22:17 -05:00
end
def up
Service.where(template: true, active: true).each do |template|
template.update(active: false) unless template.valid?
end
end
end