Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate subscribed_users from serialized attribute to table #1355

Open
steveyken opened this issue Sep 17, 2024 · 0 comments
Open

Migrate subscribed_users from serialized attribute to table #1355

steveyken opened this issue Sep 17, 2024 · 0 comments

Comments

@steveyken
Copy link
Member

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant