Remove abandoned GroupMembers

This commit is contained in:
Valery Sizov 2015-04-29 13:46:57 +03:00
parent 18a9151bf6
commit 4d3a93af2d
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"