Add scheduled_posts.artist_account_id (app#2248)

Merged
SW
1d ago
+114-2

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: nullable artist_account_id uuid → accounts(id) ON DELETE CASCADE; column comments for account_id (charged account, never an artist) and artist_account_id; partial index (artist_account_id, created_at DESC) WHERE artist_account_id IS NOT NULL for 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 to test_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_id UUID referencing accounts(id) with ON 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*.py files.
  • 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.