summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-04-29 13:46:57 +0300
committerValery Sizov <vsv2711@gmail.com>2015-04-29 13:46:57 +0300
commit4d3a93af2db702197911d2e3ef58d3365f4cc7ed (patch)
tree9a7c34c9e1695964e67e219628c8b462c23cc88f /db
parent18a9151bf60d0dd464a8e961d36bf778362d7b61 (diff)
downloadgitlab-ce-4d3a93af2db702197911d2e3ef58d3365f4cc7ed.tar.gz
Remove abandoned GroupMembers
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150429002313_remove_abandoned_group_members_records.rb6
-rw-r--r--db/schema.rb2
2 files changed, 7 insertions, 1 deletions
diff --git a/db/migrate/20150429002313_remove_abandoned_group_members_records.rb b/db/migrate/20150429002313_remove_abandoned_group_members_records.rb
new file mode 100644
index 00000000000..6013605bb35
--- /dev/null
+++ b/db/migrate/20150429002313_remove_abandoned_group_members_records.rb
@@ -0,0 +1,6 @@
+class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration
+ def change
+ execute("DELETE FROM members WHERE type = 'GroupMember' AND source_id NOT IN(\
+ SELECT id FROM namespaces WHERE type='Group')")
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8683c0446fe..2530eb6fa9d 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: 20150425173433) do
+ActiveRecord::Schema.define(version: 20150429002313) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"