fat_free_crm icon indicating copy to clipboard operation
fat_free_crm copied to clipboard

Migrate subscribed_users from serialized attribute to table

Open steveyken opened this issue 5 months ago • 0 comments

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.

steveyken avatar Sep 17 '24 07:09 steveyken