diff options
Diffstat (limited to 'db/post_migrate/20170211073944_disable_invalid_service_templates.rb')
-rw-r--r-- | db/post_migrate/20170211073944_disable_invalid_service_templates.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/db/post_migrate/20170211073944_disable_invalid_service_templates.rb b/db/post_migrate/20170211073944_disable_invalid_service_templates.rb new file mode 100644 index 00000000000..603efc43782 --- /dev/null +++ b/db/post_migrate/20170211073944_disable_invalid_service_templates.rb @@ -0,0 +1,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 |