File tree Expand file tree Collapse file tree 5 files changed +36
-0
lines changed
migrations/2022-11-23-135139_add-token-scopes Expand file tree Collapse file tree 5 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ alter table api_tokens
2+ drop column crate_scopes;
3+
4+ alter table api_tokens
5+ drop column endpoint_scopes;
Original file line number Diff line number Diff line change 1+ alter table api_tokens
2+ add column crate_scopes text [];
3+
4+ comment on column api_tokens.crate_scopes is ' NULL or an array of crate scope patterns (see RFC #2947)' ;
5+
6+ alter table api_tokens
7+ add column endpoint_scopes text [];
8+
9+ comment on column api_tokens.endpoint_scopes is ' An array of endpoint scopes or NULL for the `legacy` endpoint scope (see RFC #2947)' ;
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ pub struct ApiToken {
2323 pub last_used_at : Option < NaiveDateTime > ,
2424 #[ serde( skip) ]
2525 pub revoked : bool ,
26+ /// `None` or a list of crate scope patterns (see RFC #2947)
27+ #[ serde( skip) ]
28+ pub crate_scopes : Option < Vec < String > > ,
29+ /// A list of endpoint scopes or `None` for the `legacy` endpoint scope (see RFC #2947)
30+ #[ serde( skip) ]
31+ pub endpoint_scopes : Option < Vec < String > > ,
2632}
2733
2834impl ApiToken {
@@ -106,6 +112,8 @@ mod tests {
106112 . and_hms_opt ( 14 , 23 , 12 ) ,
107113 )
108114 . unwrap ( ) ,
115+ crate_scopes : None ,
116+ endpoint_scopes : None ,
109117 } ;
110118 let json = serde_json:: to_string ( & tok) . unwrap ( ) ;
111119 assert_some ! ( json
Original file line number Diff line number Diff line change @@ -50,6 +50,18 @@ table! {
5050 ///
5151 /// (Automatically generated by Diesel.)
5252 revoked -> Bool ,
53+ /// The `crate_scopes` column of the `api_tokens` table.
54+ ///
55+ /// Its SQL type is `Nullable<Array<Text>>`.
56+ ///
57+ /// (Automatically generated by Diesel.)
58+ crate_scopes -> Nullable <Array <Text >>,
59+ /// The `endpoint_scopes` column of the `api_tokens` table.
60+ ///
61+ /// Its SQL type is `Nullable<Array<Text>>`.
62+ ///
63+ /// (Automatically generated by Diesel.)
64+ endpoint_scopes -> Nullable <Array <Text >>,
5365 }
5466}
5567
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ name = "private"
2626created_at = " private"
2727last_used_at = " private"
2828revoked = " private"
29+ crate_scopes = " private"
30+ endpoint_scopes = " private"
2931
3032[background_jobs .columns ]
3133id = " private"
You can’t perform that action at this time.
0 commit comments