feat: add artist_id to sessions

Merged
AR
5mo ago
+42-0

Adds an artist_id column on sessions so the chat listing can filter chats by artist via their parent session.

  • artist_id UUID NULL REFERENCES accounts(id) ON DELETE CASCADE — mirrors rooms.artist_id (20250310153603_add_artist_id_to_rooms.sql).
  • idx_sessions_artist_id for direct artist lookups.
  • idx_sessions_account_artist_updated_at for the sidebar's (account, artist, recency) ordering.

Test plan

  • Apply locally; verify the column, FK, and both indexes exist.
  • Insert a session with a valid artist_id and one with NULL; both succeed.
  • Insert with a non-existent artist_id UUID; FK violation.

Summary by CodeRabbit

  • Chores
    • Database structure enhanced to properly associate sessions with specific artists, enabling improved session organization, intuitive artist-based filtering, comprehensive activity tracking, and detailed artist analytics and reporting capabilities.
    • Database performance optimized through strategic indexing improvements that accelerate artist session lookups and support efficient filtering operations by account and artist combinations for enhanced user experience.

Review Change Stack