diff --git a/db/migrate/20160820181334_remove_started_sharing_notifications_without_contact.rb b/db/migrate/20160822212739_remove_started_sharing_notifications_without_contact.rb similarity index 81% rename from db/migrate/20160820181334_remove_started_sharing_notifications_without_contact.rb rename to db/migrate/20160822212739_remove_started_sharing_notifications_without_contact.rb index 0d9d6c0bb8604ab9acecd76b5a46110ee93dfc13..70a62f68fcf97a0650e0a152deef7cab4bb78eea 100644 --- a/db/migrate/20160820181334_remove_started_sharing_notifications_without_contact.rb +++ b/db/migrate/20160822212739_remove_started_sharing_notifications_without_contact.rb @@ -5,7 +5,8 @@ class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration def up Notification.where(type: "Notifications::StartedSharing", target_type: "Person") .joins("INNER JOIN people ON people.id = notifications.target_id") - .joins("LEFT OUTER JOIN contacts ON contacts.person_id = people.id") + .joins("LEFT OUTER JOIN contacts ON contacts.person_id = people.id " \ + "AND contacts.user_id = notifications.recipient_id") .delete_all("contacts.id IS NULL") end end diff --git a/db/schema.rb b/db/schema.rb index 334178c497144b2809c9fe0224036c8279972b50..593703cb4acf66182ee3d3f810741a2ac6ecf5b3 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: 20160820181334) do +ActiveRecord::Schema.define(version: 20160822212739) do create_table "account_deletions", force: :cascade do |t| t.string "diaspora_handle", limit: 255