Merge branch 'issue_25112' into 'master'

Disable invalid service templates

Closes #25112

See merge request !8850
This commit is contained in:
Sean McGivern 2017-02-15 12:10:28 +00:00
commit e8213b3485
3 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,4 @@
---
title: Disable invalid service templates
merge_request:
author:

View file

@ -0,0 +1,15 @@
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

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170210075922) do
ActiveRecord::Schema.define(version: 20170211073944) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"