Description
From @Turbo87 in discord:
I would do it in roughly these steps:
- Add a vcs_info JSONB column to the versions table and populate it with the file content from new publishes
- Create script or temporary crates-admin command to backfill vcs_info and readme columns on versions that don't have them yet
- Adjust render-readmes to use readme column instead of downloading the crate file
- Adjust render-readmes to use the vcs_info column to render relative paths correctly for crates in subdirectories
In this strategy
Ideally admin::render_readmes does not download the crate at all.
Requires a one-off script to backfill columns to the versions
and crates
table from the downloaded crate.
If we want to support rerunning admin::render_readmes
on older versions of crates - we would need to move the readme
column to the versions table (currently it's in crates
table - only the latest version of readme is persisted - overwritten every time a new version is uploaded - never used).
Alternate strategy
Opted against this strategy in the discussion so far, but putting it here for completeness. If we considered going with this - which would enable things like #3971 and #3972
Don't use the readme column of crates
(I've just confirmed that it's completely unused currently in the codebase afaict)
Download old crates from crates.io to recalculate/find the readme again.