File tree 5 files changed +36
-0
lines changed
migrations/2022-11-23-135139_add-token-scopes
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 {
23
23
pub last_used_at : Option < NaiveDateTime > ,
24
24
#[ serde( skip) ]
25
25
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 > > ,
26
32
}
27
33
28
34
impl ApiToken {
@@ -106,6 +112,8 @@ mod tests {
106
112
. and_hms_opt ( 14 , 23 , 12 ) ,
107
113
)
108
114
. unwrap ( ) ,
115
+ crate_scopes : None ,
116
+ endpoint_scopes : None ,
109
117
} ;
110
118
let json = serde_json:: to_string ( & tok) . unwrap ( ) ;
111
119
assert_some ! ( json
Original file line number Diff line number Diff line change @@ -50,6 +50,18 @@ table! {
50
50
///
51
51
/// (Automatically generated by Diesel.)
52
52
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 >>,
53
65
}
54
66
}
55
67
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ name = "private"
26
26
created_at = " private"
27
27
last_used_at = " private"
28
28
revoked = " private"
29
+ crate_scopes = " private"
30
+ endpoint_scopes = " private"
29
31
30
32
[background_jobs .columns ]
31
33
id = " private"
You can’t perform that action at this time.
0 commit comments