summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/unreleased/zj-remove-unused-services.yml4
-rw-r--r--db/post_migrate/20161221140236_remove_unneeded_services.rb13
-rw-r--r--db/schema.rb2
3 files changed, 18 insertions, 1 deletions
diff --git a/changelogs/unreleased/zj-remove-unused-services.yml b/changelogs/unreleased/zj-remove-unused-services.yml
new file mode 100644
index 00000000000..8ede95f5faa
--- /dev/null
+++ b/changelogs/unreleased/zj-remove-unused-services.yml
@@ -0,0 +1,4 @@
+---
+title: Remove unused and void services from the database
+merge_request:
+author:
diff --git a/db/post_migrate/20161221140236_remove_unneeded_services.rb b/db/post_migrate/20161221140236_remove_unneeded_services.rb
new file mode 100644
index 00000000000..a94ccc43a41
--- /dev/null
+++ b/db/post_migrate/20161221140236_remove_unneeded_services.rb
@@ -0,0 +1,13 @@
+class RemoveUnneededServices < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ execute("DELETE FROM services WHERE active = false AND properties = '{}';")
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 13a847827cc..05b6c807660 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20161220141214) do
+ActiveRecord::Schema.define(version: 20161221140236) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"