summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-03-30 15:38:05 +0100
committerSean McGivern <sean@gitlab.com>2017-04-06 12:13:33 +0100
commit8af788e08587905bfa3455a06832ade4b3ef15c1 (patch)
tree52bde5b8f0ef31e4b6c61325c2004fa9c0563bde /db
parent618542949573ddf1636f6e28a72866105d5dbd37 (diff)
downloadgitlab-ce-8af788e08587905bfa3455a06832ade4b3ef15c1.tar.gz
Disable invalid service templates (again)
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170330141723_disable_invalid_service_templates2.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20170330141723_disable_invalid_service_templates2.rb b/db/migrate/20170330141723_disable_invalid_service_templates2.rb
new file mode 100644
index 00000000000..8424e56d8a1
--- /dev/null
+++ b/db/migrate/20170330141723_disable_invalid_service_templates2.rb
@@ -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