Skip to content

Commit 27f0366

Browse files
committed
database: Create github_oidc_configs table
1 parent 6f9d16a commit 27f0366

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

crates/crates_io_database/src/schema.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,28 @@ diesel::table! {
561561
}
562562
}
563563

564+
diesel::table! {
565+
/// Trusted Publisher OIDC configuration for GitHub Actions
566+
github_oidc_configs (id) {
567+
/// Unique identifier of the `github_oidc_configs` row
568+
id -> Int4,
569+
/// Unique identifier of the crate that this configuration is for
570+
crate_id -> Int4,
571+
/// GitHub user or organization that owns the repository
572+
repository_owner -> Varchar,
573+
/// Unique identifier of the user or organization that owns the repository
574+
repository_owner_id -> Int4,
575+
/// Name of the repository that this configuration is for
576+
repository_name -> Varchar,
577+
/// Name of the workflow file inside the repository that will be used to publish the crate
578+
workflow_filename -> Varchar,
579+
/// Optional publish environment that will be used to publish the crate
580+
environment -> Nullable<Varchar>,
581+
/// Date and time when the configuration was created
582+
created_at -> Timestamptz,
583+
}
584+
}
585+
564586
diesel::table! {
565587
/// Representation of the `keywords` table.
566588
///
@@ -1066,6 +1088,7 @@ diesel::joinable!(dependencies -> versions (version_id));
10661088
diesel::joinable!(emails -> users (user_id));
10671089
diesel::joinable!(follows -> crates (crate_id));
10681090
diesel::joinable!(follows -> users (user_id));
1091+
diesel::joinable!(github_oidc_configs -> crates (crate_id));
10691092
diesel::joinable!(publish_limit_buckets -> users (user_id));
10701093
diesel::joinable!(publish_rate_overrides -> users (user_id));
10711094
diesel::joinable!(readme_renderings -> versions (version_id));
@@ -1093,6 +1116,7 @@ diesel::allow_tables_to_appear_in_same_query!(
10931116
dependencies,
10941117
emails,
10951118
follows,
1119+
github_oidc_configs,
10961120
keywords,
10971121
metadata,
10981122
processed_log_files,

crates/crates_io_database_dump/src/dump-db.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ token_generated_at = "private"
148148
user_id = "private"
149149
crate_id = "private"
150150

151+
[github_oidc_configs]
152+
dependencies = ["crates"]
153+
[github_oidc_configs.columns]
154+
id = "private"
155+
crate_id = "private"
156+
repository_owner = "private"
157+
repository_owner_id = "private"
158+
repository_name = "private"
159+
workflow_filename = "private"
160+
environment = "private"
161+
created_at = "private"
162+
151163
[keywords.columns]
152164
id = "public"
153165
keyword = "public"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
drop table github_oidc_configs;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
create table github_oidc_configs
2+
(
3+
id serial primary key,
4+
crate_id int not null references crates on delete cascade,
5+
repository_owner varchar not null,
6+
repository_owner_id int not null,
7+
repository_name varchar not null,
8+
workflow_filename varchar not null,
9+
environment varchar,
10+
created_at timestamptz not null default now()
11+
);
12+
13+
comment on table github_oidc_configs is 'Trusted Publisher OIDC configuration for GitHub Actions';
14+
comment on column github_oidc_configs.id is 'Unique identifier of the `github_oidc_configs` row';
15+
comment on column github_oidc_configs.crate_id is 'Unique identifier of the crate that this configuration is for';
16+
comment on column github_oidc_configs.repository_owner is 'GitHub user or organization that owns the repository';
17+
comment on column github_oidc_configs.repository_owner_id is 'Unique identifier of the user or organization that owns the repository';
18+
comment on column github_oidc_configs.repository_name is 'Name of the repository that this configuration is for';
19+
comment on column github_oidc_configs.workflow_filename is 'Name of the workflow file inside the repository that will be used to publish the crate';
20+
comment on column github_oidc_configs.environment is 'Optional publish environment that will be used to publish the crate';
21+
comment on column github_oidc_configs.created_at is 'Date and time when the configuration was created';
22+
23+
create index github_oidc_configs_repository_owner_id_repository_name_index
24+
on github_oidc_configs (repository_owner_id, repository_name);

0 commit comments

Comments
 (0)