summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-04-06 13:47:50 +0000
committerJames Lopez <james@jameslopez.es>2017-04-10 09:30:32 +0200
commit8e96336f7922868820e9f0da5fa2fadc1faa9c16 (patch)
tree76a9d23f01c34f3765b3aad3b6b34dd6f1b29299
parent894817fcc9046d03e2d3456b6a52b59e6facfecf (diff)
downloadgitlab-ce-8e96336f7922868820e9f0da5fa2fadc1faa9c16.tar.gz
Merge branch '30024-owner-can-t-initialize-git-repo-for-new-project-in-group' into 'master'
Disable invalid service templates (again) Closes #30024 See merge request !10339
-rw-r--r--changelogs/unreleased/30024-owner-can-t-initialize-git-repo-for-new-project-in-group.yml4
-rw-r--r--db/migrate/20170330141723_disable_invalid_service_templates2.rb18
2 files changed, 22 insertions, 0 deletions
diff --git a/changelogs/unreleased/30024-owner-can-t-initialize-git-repo-for-new-project-in-group.yml b/changelogs/unreleased/30024-owner-can-t-initialize-git-repo-for-new-project-in-group.yml
new file mode 100644
index 00000000000..c43d2732b9a
--- /dev/null
+++ b/changelogs/unreleased/30024-owner-can-t-initialize-git-repo-for-new-project-in-group.yml
@@ -0,0 +1,4 @@
+---
+title: Disable invalid service templates
+merge_request:
+author:
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