Add scheduled_posts.artist_account_id (app#2248)
Merged
SW
1d ago+114+114+012345678901234567890123456789-2-2-0123456789
Implements the database step of app#2248: credits are charged to the resolved account_id, never an artist, so the artist a post goes out from needs its own column.
supabase/migrations/20261019200000_scheduled_posts_artist_account_id.sql: nullableartist_account_id uuid→accounts(id) ON DELETE CASCADE; column comments foraccount_id(charged account, never an artist) andartist_account_id; partial index(artist_account_id, created_at DESC) WHERE artist_account_id IS NOT NULLfor List Posts' new filter. Idempotent.tests/test_scheduled_posts_artist.py(new file): stored beside the charged account, optional, unknown artist rejected by the FK, deleting the artist deletes its posts. CI glob widened totest_scheduled_posts*.py.
Merge order: marketing (docs contract) → this → api (writes the column) → docs publication copy.
Local: python3 -m unittest discover -s tests -p 'test_scheduled_posts*.py' → 10 tests OK (RED before the migration existed).
🤖 Generated with Claude Code
Summary by cubic
Adds scheduled_posts.artist_account_id so a post sent from an artist's connected social account can track the artist separately from the account it's charged to. account_id is now documented as the charged account and never an artist.
- Migration adds a nullable
artist_account_idUUID referencingaccounts(id)withON DELETE CASCADE, a partial index on(artist_account_id, created_at DESC), and comments clarifying both columns. It's idempotent. - New tests cover storing the artist, optional artist (NULL), FK rejection of unknown artists, and cascade delete; CI now runs all
test_scheduled_posts*.pyfiles. - Merge order: marketing → this migration → api (writes the column) → docs publication copy.
Summary by CodeRabbit
- New Features
- Scheduled posts can now identify the artist’s connected social account separately from the account responsible for the post. When no artist account is specified, posts continue to use the account’s own connection. Scheduled posts associated with an artist account are removed if that account is deleted. This makes it clearer which connection will publish a post and which account is responsible for it.