Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20170330141723_disable_invalid_service_templates2.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 91ec19dfa8764e2241fd9e39c234d5ae970afacd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# This is the same as DisableInvalidServiceTemplates. Later migrations may have
# inadventently enabled some invalid templates again.
#
class DisableInvalidServiceTemplates2 < ActiveRecord::Migration[4.2]
  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