feat(npm): npm remote packages schema (S15 Step 1b)

📦 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 2 of 3 of npm remote — Step 1: the npm_remote_packages table.

Creates the cached-package table per the S15 Data Model (a package within a remote repository):

  • HASH(namespace_id) partitioned into 64 partitions, PK (id, namespace_id), FK to npm_remote_repositories(id, namespace_id).
  • Partial-unique index (namespace_id, npm_remote_repository_id, name) WHERE soft_deleted_at IS NULL — a name is unique among live rows, allowing re-cache after soft-delete.
  • Full (non-partial) FK-coverage index (namespace_id, npm_remote_repository_id) — the partial-unique above cannot serve the RI check on a parent delete.

Includes integration tests (length CHECKs, FK reject + no-cascade RESTRICT, partial-unique resurrection, index existence). Depends on part 1 (its FK target). npm_remote_versions (part 3) stacks on this branch.

  • 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