Skip to content

content-studio: add Instagram publish DB foundation (#593) #596

@thxforall

Description

@thxforall

Parent

Parent: #593

What to build

Add the database and type foundation for Content Studio Instagram feed publishing. This establishes instagram_feed as a first-class Content Variant format and creates the publish account/job persistence needed by later publish service work.

This task must not add UI behavior, generation behavior, publish request/response DTOs, Next route schemas, publishJobsByVariantId, or Meta API calls.

Acceptance criteria

  • content_variants.format accepts instagram_feed through the primary Supabase SQL migration.
  • content_publish_accounts and content_publish_jobs exist with indexes and admin-only RLS policies matching content_packets / content_variants.
  • The latest-job index supports deterministic ordering with (variant_id, created_at DESC, id DESC).
  • content_publish_jobs.status allows only queued, processing, published, and failed; no uploading state.
  • The migration is idempotent and updates the existing format constraint safely by confirming the current constraint name, then using DROP CONSTRAINT IF EXISTS <current_name> and ADD CONSTRAINT with that name.
  • Publish job FKs preserve audit history: variant_id and account_id are ON DELETE RESTRICT, requested_by is ON DELETE SET NULL, and account disablement uses status = 'disabled'.
  • content_publish_accounts.created_by is nullable for env-backed lazy-upserted accounts; content_publish_jobs.requested_by records the publish-requesting admin.
  • content_publish_jobs stores both platform and format with MVP-narrow CHECK constraints.
  • SeaORM migration/entities are added only as Rust/prod parity with the Supabase SQL schema.
  • Web/Rust DB types are limited to foundation types: Supabase table types, instagram_feed format acceptance, SeaORM publish account/job entities, and entity exports.
  • Publish DTOs, publishJobsByVariantId, Next route schemas, UI state, and generation defaults/templates/prompts are left to later tasks.
  • Migration verification is documented in the PR, including whether supabase db reset or direct migration apply against LOCAL_DATABASE_URL was run, plus the TypeScript/Rust compile or focused test result.

Blocked by

None - can start immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions