Skip to content

Feature Request: Support Polymorphic Ownership for Conversations #596

Description

@amansandhu0011

AI SDK
Currently, the conversations and messages tables use a direct user_id column:

$table->foreignId('user_id')->nullable();

This assumes that every conversation belongs to a User model. However, there are cases where conversation context may need to be associated with other model types instead of only authenticated users.

For example:

Guest sessions
Custom customer models
Organizations/workspaces
AI agents or bots
External identities
Multi-tenant applications

Would it make sense to support a polymorphic relationship for conversation ownership instead of coupling it directly to user_id?

Something similar to:

$table->nullableMorphs('conversable');

This could make the conversation system more flexible for applications where the owner of the conversation is not always a User model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions