"Additive schema plan: scholarly external jobs and snapshots"

Additive schema plan: scholarly external jobs and snapshots

Operational tables live in the publish_cloud domain (publish_cloud.rs). Migrations should remain additive (new tables/columns/indexes) unless a breaking cutover is explicitly scheduled.

Current artifacts (reference)

ConcernTable(s)Notes
Outbound work queueexternal_submission_jobsStatus, lease columns, idempotency key, attempt_count
Per-try auditexternal_submission_attemptsHTTP status, error_class, retryable, fingerprints
Remote truth cacheexternal_status_snapshotsAdapter + external id keyed snapshots
Local receiptscholarly_submissionsDigest-bound submission rows

Future additions (when needed)

  1. Revision mapping — If adapters expose multiple revisions per submission, add scholarly_revision_map (names indicative) keyed by (publication_id, content_sha3_256, adapter, external_submission_id, revision_id) with created_at_ms; keep scholarly_submissions as the primary “head” receipt.
  2. Dead-letter — Optional external_submission_jobs_dead or status = dead_lettered + dead_lettered_at_ms on the job row once replay UX exists.
  3. Idempotency index — Ensure unique index on (adapter, idempotency_key) remains enforced when adding partial unique variants per environment.

Migration discipline