Closed
Description
Reported by @koenaad:
So, I was checking out the database of docs.rs, I am a bit confused about why there is a column versions in the crates table: https://github.com/rust-lang/docs.rs/blob/master/src/db/migrate.rs#L105
The table releases contains the releases per crate and also has a column version. So the same information can be retrieved by doing a join between crates and releases. Something like this:
select crates."name", releases."version", releases.release_time, releases.build_status
from releases
inner join crates on releases.crate_id = crates.id
where crates.name = 'fie'
order by releases.release_time desc;
It seems to kept in sync by add_package: https://github.com/rust-lang/docs.rs/blob/master/src/db/add_package.rs#L151.
There's no sense in storing duplicate data in postgres, so I'd like to see the crates.version
column removed eventually.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
yvrhdn commentedon Jan 4, 2020
I can remove the use of
crates.versions
incrate_details.rs
(https://github.com/rust-lang/docs.rs/blob/master/src/web/crate_details.rs#L114) when implementing the 2nd change of #516 (comment)jyn514 commentedon Jan 4, 2020
I would rather separate feature PRs from refactoring PRs. Our test suite still isn't as good as I'd like and smaller PRs makes it easier to rollback commits. This is especially true for the SQL queries which are mostly not type checked, if you delete
crates.version
there will be no compile errors but the site may panic at runtime.jyn514 commentedon Jan 4, 2020
See #466 for an example of a PR that passed all tests but still crashed the site.
(This is why this issue is marked as
wishlist
)jyn514 commentedon Jun 27, 2020
Fixed in #804