Skip to content

Commit e59a369

Browse files
committed
database: Add trustpub_configs_gitlab table
1 parent b42f48c commit e59a369

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,26 @@ 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+
/// Name of the GitLab project that this configuration is for
814+
project -> Varchar,
815+
/// Path to the CI/CD configuration file that will be used to publish the crate
816+
workflow_filepath -> Varchar,
817+
/// GitLab environment that will be used to publish the crate (if `NULL` the environment is unrestricted)
818+
environment -> Nullable<Varchar>,
819+
}
820+
}
821+
802822
diesel::table! {
803823
/// Temporary access tokens for Trusted Publishing
804824
trustpub_tokens (id) {
@@ -1137,6 +1157,7 @@ diesel::joinable!(publish_rate_overrides -> users (user_id));
11371157
diesel::joinable!(readme_renderings -> versions (version_id));
11381158
diesel::joinable!(recent_crate_downloads -> crates (crate_id));
11391159
diesel::joinable!(trustpub_configs_github -> crates (crate_id));
1160+
diesel::joinable!(trustpub_configs_gitlab -> crates (crate_id));
11401161
diesel::joinable!(version_downloads -> versions (version_id));
11411162
diesel::joinable!(version_owner_actions -> api_tokens (api_token_id));
11421163
diesel::joinable!(version_owner_actions -> users (user_id));
@@ -1171,6 +1192,7 @@ diesel::allow_tables_to_appear_in_same_query!(
11711192
reserved_crate_names,
11721193
teams,
11731194
trustpub_configs_github,
1195+
trustpub_configs_gitlab,
11741196
trustpub_tokens,
11751197
trustpub_used_jtis,
11761198
users,

crates/crates_io_database_dump/src/dump-db.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ 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+
project = "private"
216+
workflow_filepath = "private"
217+
environment = "private"
218+
208219
[trustpub_tokens.columns]
209220
id = "private"
210221
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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
project VARCHAR NOT NULL,
7+
workflow_filepath VARCHAR NOT NULL,
8+
environment VARCHAR
9+
);
10+
11+
comment on table trustpub_configs_gitlab is 'Trusted Publisher configuration for GitLab CI';
12+
comment on column trustpub_configs_gitlab.id is 'Unique identifier of the `trustpub_configs_gitlab` row';
13+
comment on column trustpub_configs_gitlab.created_at is 'Date and time when the configuration was created';
14+
comment on column trustpub_configs_gitlab.crate_id is 'Unique identifier of the crate that this configuration is for';
15+
comment on column trustpub_configs_gitlab.namespace is 'GitLab namespace (user or group) that owns the project';
16+
comment on column trustpub_configs_gitlab.project is 'Name of the GitLab project that this configuration is for';
17+
comment on column trustpub_configs_gitlab.workflow_filepath is 'Path to the CI/CD configuration file that will be used to publish the crate';
18+
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)