Skip to content

Introduce a model for npm metadata

🌱 Context

We need a new ActiveRecord model to store and operate a metadata cache. It highly recommended to have it scoped by the package format to avoid scalability issues in the future while searching for the record and to prevent the growth of the table when adding uniq fields needed only for the particular package format.

Proposal

For npm Registry packages create a new model Packages::Npm::MetadataCache with:

  • package_name (not null)
  • project_id (not null)
  • abbreviated_metadata (not null)
  • last_downloaded_at (timestamp with time zone)
  • created_at
  • updated_at

Additions

  • Mount an uploader to the abbreviated_metadata field to store a metadata using the object storage.
  • Add a uniq index for a pair package_name and project_id.
Edited by Dzmitry (Dima) Meshcharakou