File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed
crates_io_database_dump/src
migrations/2025-04-15-100719_oidc-tokens Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -629,6 +629,22 @@ diesel::table! {
629629 }
630630}
631631
632+ diesel:: table! {
633+ /// Temporary access tokens for OIDC-based publishing (aka. Trusted Publishing)
634+ oidc_tokens ( id) {
635+ /// Unique identifier of the `oidc_tokens` row
636+ id -> Int8 ,
637+ /// Unique identifier of the crate that can be published using this token
638+ crate_id -> Int4 ,
639+ /// SHA256 hash of the token that can be used to publish the crate
640+ hashed_token -> Bytea ,
641+ /// Date and time when the token was created
642+ created_at -> Timestamptz ,
643+ /// Date and time when the token will expire
644+ expires_at -> Timestamptz ,
645+ }
646+ }
647+
632648diesel:: table! {
633649 /// List of all processed CDN log files, used to avoid processing the same file multiple times.
634650 processed_log_files ( path) {
@@ -1089,6 +1105,7 @@ diesel::joinable!(emails -> users (user_id));
10891105diesel:: joinable!( follows -> crates ( crate_id) ) ;
10901106diesel:: joinable!( follows -> users ( user_id) ) ;
10911107diesel:: joinable!( github_oidc_configs -> crates ( crate_id) ) ;
1108+ diesel:: joinable!( oidc_tokens -> crates ( crate_id) ) ;
10921109diesel:: joinable!( publish_limit_buckets -> users ( user_id) ) ;
10931110diesel:: joinable!( publish_rate_overrides -> users ( user_id) ) ;
10941111diesel:: joinable!( readme_renderings -> versions ( version_id) ) ;
@@ -1119,6 +1136,7 @@ diesel::allow_tables_to_appear_in_same_query!(
11191136 github_oidc_configs,
11201137 keywords,
11211138 metadata,
1139+ oidc_tokens,
11221140 processed_log_files,
11231141 publish_limit_buckets,
11241142 publish_rate_overrides,
Original file line number Diff line number Diff line change @@ -169,6 +169,15 @@ created_at = "public"
169169[metadata .columns ]
170170total_downloads = " public"
171171
172+ [oidc_tokens ]
173+ dependencies = [" crates" ]
174+ [oidc_tokens .columns ]
175+ id = " private"
176+ crate_id = " private"
177+ hashed_token = " private"
178+ created_at = " private"
179+ expires_at = " private"
180+
172181[processed_log_files .columns ]
173182path = " private"
174183time = " private"
Original file line number Diff line number Diff line change 1+ drop table oidc_tokens;
Original file line number Diff line number Diff line change 1+ create table oidc_tokens
2+ (
3+ id bigserial primary key ,
4+ crate_id int not null references crates on delete cascade ,
5+ hashed_token bytea not null ,
6+ created_at timestamptz not null default now(),
7+ expires_at timestamptz not null
8+ );
9+
10+ comment on table oidc_tokens is ' Temporary access tokens for OIDC-based publishing (aka. Trusted Publishing)' ;
11+ comment on column oidc_tokens.id is ' Unique identifier of the `oidc_tokens` row' ;
12+ comment on column oidc_tokens.crate_id is ' Unique identifier of the crate that can be published using this token' ;
13+ comment on column oidc_tokens.hashed_token is ' SHA256 hash of the token that can be used to publish the crate' ;
14+ comment on column oidc_tokens.created_at is ' Date and time when the token was created' ;
15+ comment on column oidc_tokens.expires_at is ' Date and time when the token will expire' ;
16+
17+ create unique index oidc_tokens_crate_id_hashed_token_uindex
18+ on oidc_tokens (crate_id, hashed_token);
You can’t perform that action at this time.
0 commit comments