Skip to content

Commit 4a00cd1

Browse files
committed
database: Add description, homepage, documentation and repository columns to the versions table
1 parent 40bb88f commit 4a00cd1

File tree

7 files changed

+33
-2
lines changed

7 files changed

+33
-2
lines changed

crates/crates_io_database/src/schema.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,14 @@ diesel::table! {
10131013
num_no_build -> Varchar,
10141014
/// The declared Rust Edition required to compile this version of the crate.
10151015
edition -> Nullable<Text>,
1016+
/// Value of the `description` field in the `Cargo.toml` file of this version.
1017+
description -> Nullable<Text>,
1018+
/// Value of the `homepage` field in the `Cargo.toml` file of this version.
1019+
homepage -> Nullable<Text>,
1020+
/// Value of the `documentation` field in the `Cargo.toml` file of this version.
1021+
documentation -> Nullable<Text>,
1022+
/// Value of the `repository` field in the `Cargo.toml` file of this version.
1023+
repository -> Nullable<Text>,
10161024
}
10171025
}
10181026

crates/crates_io_database_dump/src/dump-db.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ has_lib = "public"
247247
bin_names = "public"
248248
yank_message = "private"
249249
edition = "public"
250+
description = "public"
251+
homepage = "public"
252+
documentation = "public"
253+
repository = "public"
250254

251255
[versions_published_by.columns]
252256
version_id = "private"

crates/crates_io_database_dump/src/snapshots/[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BEGIN ISOLATION LEVEL REPEATABLE READ, READ ONLY;
1818
\copy "crates_keywords" ("crate_id", "keyword_id") TO 'data/crates_keywords.csv' WITH CSV HEADER
1919
\copy (SELECT "crate_id", "created_at", "created_by", "owner_id", "owner_kind" FROM "crate_owners" WHERE NOT deleted) TO 'data/crate_owners.csv' WITH CSV HEADER
2020

21-
\copy "versions" ("bin_names", "checksum", "crate_id", "crate_size", "created_at", "downloads", "edition", "features", "has_lib", "id", "license", "links", "num", "published_by", "rust_version", "updated_at", "yanked") TO 'data/versions.csv' WITH CSV HEADER
21+
\copy "versions" ("bin_names", "checksum", "crate_id", "crate_size", "created_at", "description", "documentation", "downloads", "edition", "features", "has_lib", "homepage", "id", "license", "links", "num", "published_by", "repository", "rust_version", "updated_at", "yanked") TO 'data/versions.csv' WITH CSV HEADER
2222
\copy "default_versions" ("crate_id", "version_id") TO 'data/default_versions.csv' WITH CSV HEADER
2323
\copy "dependencies" ("crate_id", "default_features", "explicit_name", "features", "id", "kind", "optional", "req", "target", "version_id") TO 'data/dependencies.csv' WITH CSV HEADER
2424
\copy "version_downloads" ("date", "downloads", "version_id") TO 'data/version_downloads.csv' WITH CSV HEADER

crates/crates_io_database_dump/src/snapshots/[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ BEGIN;
6060
\copy "crates_categories" ("category_id", "crate_id") FROM 'data/crates_categories.csv' WITH CSV HEADER
6161
\copy "crates_keywords" ("crate_id", "keyword_id") FROM 'data/crates_keywords.csv' WITH CSV HEADER
6262
\copy "crate_owners" ("crate_id", "created_at", "created_by", "owner_id", "owner_kind") FROM 'data/crate_owners.csv' WITH CSV HEADER
63-
\copy "versions" ("bin_names", "checksum", "crate_id", "crate_size", "created_at", "downloads", "edition", "features", "has_lib", "id", "license", "links", "num", "published_by", "rust_version", "updated_at", "yanked") FROM 'data/versions.csv' WITH CSV HEADER
63+
\copy "versions" ("bin_names", "checksum", "crate_id", "crate_size", "created_at", "description", "documentation", "downloads", "edition", "features", "has_lib", "homepage", "id", "license", "links", "num", "published_by", "repository", "rust_version", "updated_at", "yanked") FROM 'data/versions.csv' WITH CSV HEADER
6464
\copy "default_versions" ("crate_id", "version_id") FROM 'data/default_versions.csv' WITH CSV HEADER
6565
\copy "dependencies" ("crate_id", "default_features", "explicit_name", "features", "id", "kind", "optional", "req", "target", "version_id") FROM 'data/dependencies.csv' WITH CSV HEADER
6666
\copy "version_downloads" ("date", "downloads", "version_id") FROM 'data/version_downloads.csv' WITH CSV HEADER
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alter table versions
2+
drop column description,
3+
drop column homepage,
4+
drop column documentation,
5+
drop column repository;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
alter table versions
2+
add column description text,
3+
add column homepage text,
4+
add column documentation text,
5+
add column repository text;
6+
7+
comment on column versions.description is 'Value of the `description` field in the `Cargo.toml` file of this version.';
8+
comment on column versions.homepage is 'Value of the `homepage` field in the `Cargo.toml` file of this version.';
9+
comment on column versions.documentation is 'Value of the `documentation` field in the `Cargo.toml` file of this version.';
10+
comment on column versions.repository is 'Value of the `repository` field in the `Cargo.toml` file of this version.';

src/models/version.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ pub struct Version {
3434
pub yank_message: Option<String>,
3535
pub num_no_build: String,
3636
pub edition: Option<String>,
37+
pub description: Option<String>,
38+
pub homepage: Option<String>,
39+
pub documentation: Option<String>,
40+
pub repository: Option<String>,
3741
}
3842

3943
impl Version {

0 commit comments

Comments
 (0)