Skip to content

Migrate subscribed_users from serialized attribute to table #1355

Open
@steveyken

Description

@steveyken

It seems strange to me that 'subscribed_users' is not a join table. Instead, it is a serialized attribute on each of Contacts, Accounts, Opportunities, Campaigns, Leads and Tasks. This makes it difficult to enumerate which entities a user is subscribed too and also makes it much harder to remove a subscription when the user is deleted (effectively having to load and search all entities for the subscribed user id.

Suggested improvements:

  • Create a polymorphic join table called comment_subscriptions
  • The join columns are user_id and (entity_type, entity_id) where entity is Contact, Account, Opportunity, Campaign, Lead or Task
  • Add a migration to move from subscribed_user attribute to comment_subscriptions table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions