Skip to content

Commit 309eb6d

Browse files
committed
database: Add trustpub_configs_gitlab table
1 parent dc355de commit 309eb6d

File tree

5 files changed

+58
-1
lines changed

5 files changed

+58
-1
lines changed

crates/crates_io_database/src/schema.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
diesel::joinable!(readme_renderings -> versions (version_id));
8787
+diesel::joinable!(recent_crate_downloads -> crates (crate_id));
8888
diesel::joinable!(trustpub_configs_github -> crates (crate_id));
89+
diesel::joinable!(trustpub_configs_gitlab -> crates (crate_id));
8990
diesel::joinable!(version_downloads -> versions (version_id));
90-
diesel::joinable!(version_owner_actions -> api_tokens (api_token_id));
9191
@@ -1140,6 +1152,7 @@
9292
publish_limit_buckets,
9393
publish_rate_overrides,

crates/crates_io_database/src/schema.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,28 @@ diesel::table! {
799799
}
800800
}
801801

802+
diesel::table! {
803+
/// Trusted Publisher configuration for GitLab CI
804+
trustpub_configs_gitlab (id) {
805+
/// Unique identifier of the `trustpub_configs_gitlab` row
806+
id -> Int4,
807+
/// Date and time when the configuration was created
808+
created_at -> Timestamptz,
809+
/// Unique identifier of the crate that this configuration is for
810+
crate_id -> Int4,
811+
/// GitLab namespace (user or group) that owns the project
812+
namespace -> Varchar,
813+
/// GitLab namespace ID, populated on first token exchange for resurrection attack protection
814+
namespace_id -> Nullable<Varchar>,
815+
/// Name of the GitLab project that this configuration is for
816+
project -> Varchar,
817+
/// Path to the CI/CD configuration file that will be used to publish the crate
818+
workflow_filepath -> Varchar,
819+
/// GitLab environment that will be used to publish the crate (if `NULL` the environment is unrestricted)
820+
environment -> Nullable<Varchar>,
821+
}
822+
}
823+
802824
diesel::table! {
803825
/// Temporary access tokens for Trusted Publishing
804826
trustpub_tokens (id) {
@@ -1137,6 +1159,7 @@ diesel::joinable!(publish_rate_overrides -> users (user_id));
11371159
diesel::joinable!(readme_renderings -> versions (version_id));
11381160
diesel::joinable!(recent_crate_downloads -> crates (crate_id));
11391161
diesel::joinable!(trustpub_configs_github -> crates (crate_id));
1162+
diesel::joinable!(trustpub_configs_gitlab -> crates (crate_id));
11401163
diesel::joinable!(version_downloads -> versions (version_id));
11411164
diesel::joinable!(version_owner_actions -> api_tokens (api_token_id));
11421165
diesel::joinable!(version_owner_actions -> users (user_id));
@@ -1171,6 +1194,7 @@ diesel::allow_tables_to_appear_in_same_query!(
11711194
reserved_crate_names,
11721195
teams,
11731196
trustpub_configs_github,
1197+
trustpub_configs_gitlab,
11741198
trustpub_tokens,
11751199
trustpub_used_jtis,
11761200
users,

crates/crates_io_database_dump/src/dump-db.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,18 @@ repository_name = "private"
205205
workflow_filename = "private"
206206
environment = "private"
207207

208+
[trustpub_configs_gitlab]
209+
dependencies = ["crates"]
210+
[trustpub_configs_gitlab.columns]
211+
id = "private"
212+
created_at = "private"
213+
crate_id = "private"
214+
namespace = "private"
215+
namespace_id = "private"
216+
project = "private"
217+
workflow_filepath = "private"
218+
environment = "private"
219+
208220
[trustpub_tokens.columns]
209221
id = "private"
210222
created_at = "private"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE trustpub_configs_gitlab;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CREATE TABLE trustpub_configs_gitlab (
2+
id SERIAL PRIMARY KEY,
3+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
4+
crate_id INTEGER NOT NULL REFERENCES crates ON DELETE CASCADE,
5+
namespace VARCHAR NOT NULL,
6+
namespace_id VARCHAR,
7+
project VARCHAR NOT NULL,
8+
workflow_filepath VARCHAR NOT NULL,
9+
environment VARCHAR
10+
);
11+
12+
comment on table trustpub_configs_gitlab is 'Trusted Publisher configuration for GitLab CI';
13+
comment on column trustpub_configs_gitlab.id is 'Unique identifier of the `trustpub_configs_gitlab` row';
14+
comment on column trustpub_configs_gitlab.created_at is 'Date and time when the configuration was created';
15+
comment on column trustpub_configs_gitlab.crate_id is 'Unique identifier of the crate that this configuration is for';
16+
comment on column trustpub_configs_gitlab.namespace is 'GitLab namespace (user or group) that owns the project';
17+
comment on column trustpub_configs_gitlab.namespace_id is 'GitLab namespace ID, populated on first token exchange for resurrection attack protection';
18+
comment on column trustpub_configs_gitlab.project is 'Name of the GitLab project that this configuration is for';
19+
comment on column trustpub_configs_gitlab.workflow_filepath is 'Path to the CI/CD configuration file that will be used to publish the crate';
20+
comment on column trustpub_configs_gitlab.environment is 'GitLab environment that will be used to publish the crate (if `NULL` the environment is unrestricted)';

0 commit comments

Comments
 (0)