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

20170211073944_disable_invalid_service_templates.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 603efc43782f49d243a8e10afe7a882a77a43332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
class DisableInvalidServiceTemplates < ActiveRecord::Migration
  DOWNTIME = false

  class Service < ActiveRecord::Base
    self.inheritance_column = nil
  end

  def up
    Service.where(template: true, active: true).each do |template|
      template.update(active: false) unless template.valid?
    end
  end
end