Merge branch 'issue_25112' into 'master'
Disable invalid service templates Closes #25112 See merge request !8850
This commit is contained in:
commit
e8213b3485
3 changed files with 20 additions and 1 deletions
4
changelogs/unreleased/issue_25112.yml
Normal file
4
changelogs/unreleased/issue_25112.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Disable invalid service templates
|
||||
merge_request:
|
||||
author:
|
|
@ -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
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue