diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-04-29 13:46:57 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-04-29 14:30:45 +0300 |
commit | 5dd1deb2b0c28a27bac04bed0bca32e2f015a9fc (patch) | |
tree | 74d72c84575c1c6127452e107e67370a4f85c728 | |
parent | a651951723269ff414fb1047e83b5075a5733533 (diff) |
Remove abandoned GroupMembers
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
db/schema.rb
-rw-r--r-- | db/migrate/20150429002313_remove_abandoned_group_members_records.rb | 6 | ||||
-rw-r--r-- | db/schema.rb | 2 |
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 1aee37b2e61..189bd536626 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: 20150417122318) do +ActiveRecord::Schema.define(version: 20150429002313) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |