Disable invalid service templates (again)
This commit is contained in:
parent
6185429495
commit
8af788e085
2 changed files with 22 additions and 0 deletions
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Disable invalid service templates
|
||||
merge_request:
|
||||
author:
|
|
@ -0,0 +1,18 @@
|
|||
# This is the same as DisableInvalidServiceTemplates. Later migrations may have
|
||||
# inadventently enabled some invalid templates again.
|
||||
#
|
||||
class DisableInvalidServiceTemplates2 < 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
|
Loading…
Reference in a new issue