feat(npm): npm remote versions schema + FK-coverage index (S15 Step 1c)

📦 Stacked MRs

This change splits S15 Step 1 (the npm-remote core schema) into 3 stacked merge requests, one migration per MR, so each table lands and is reviewed on its own. Each part targets the previous one (part 1 targets main). Please review and merge them in order, bottom-up — merging part 1 auto-retargets the rest.

Stack (review/merge bottom-up)

📌 This part

Part 3 of 3 of npm remote — Step 1: the npm_remote_versions table, completing S15 Step 1.

Creates the per-version cache-anchor table per the S15 Data Model:

  • HASH(namespace_id) partitioned into 64 partitions, PK (id, namespace_id), FK to npm_remote_packages(id, namespace_id).
  • Partial-unique (namespace_id, npm_remote_package_id, version) WHERE soft_deleted_at IS NULL, the size-ordered (S17) and trash (S20) partial indexes, the unconditional created_at provenance index, and a full FK-coverage index (namespace_id, npm_remote_package_id).

Also amends the S15 spec (docs/specs/S15-npm-remote.md) to document the versions FK-coverage index — raised during branch review as a spec/implementation consistency gap. The S15 spec is owned by David Fernandez; the spec delta should get their review.

Includes integration tests (length CHECK, FK reject + no-cascade RESTRICT, partial-unique resurrection, all four secondary indexes). Depends on part 2 (its FK target).

  • Plan: docs/plans/2026-07-15-npm-remote.md — Step 1
  • Spec: docs/specs/S15-npm-remote.md — Data Model

Related to #338 (closed)

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading
Loading