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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-02-15 15:10:28 +0300
committerSean McGivern <sean@mcgivern.me.uk>2017-02-15 15:10:28 +0300
commite8213b34854fada5174d80a4c5892e7eff81acc6 (patch)
treec239ade4c08f1ae651a741f0ee2d7158577de2e8 /db/post_migrate
parent88132258d66ca955b0e9bd93d4ee8dc12cc54537 (diff)
parentde12a69a3c33562e7cd4fa81b5e12799a3f68f95 (diff)
Merge branch 'issue_25112' into 'master'
Disable invalid service templates Closes #25112 See merge request !8850
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20170211073944_disable_invalid_service_templates.rb15
1 files changed, 15 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..84954b1ef64
--- /dev/null
+++ b/db/post_migrate/20170211073944_disable_invalid_service_templates.rb
@@ -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