Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database: Drop badges table #8155

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions migrations/2024-02-19-113226_delete-badges-table/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
create table if not exists badges
(
crate_id integer not null
constraint fk_badges_crate_id
references crates
on delete cascade,
badge_type varchar not null,
attributes jsonb not null,
primary key (crate_id, badge_type)
);
1 change: 1 addition & 0 deletions migrations/2024-02-19-113226_delete-badges-table/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop table badges;
28 changes: 12 additions & 16 deletions src/schema.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
diff --git a/src/schema.rs b/src/schema.rs
index bb2658942..1bc6801ea 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -14,9 +14,7 @@ pub mod sql_types {
@@ -21,9 +21,7 @@
/// The `pg_catalog.tsvector` SQL type
///
/// (Automatically generated by Diesel.)
Expand All @@ -13,7 +9,7 @@ index bb2658942..1bc6801ea 100644
}

diesel::table! {
@@ -67,9 +65,9 @@ diesel::table! {
@@ -74,9 +72,9 @@
/// (Automatically generated by Diesel.)
revoked -> Bool,
/// NULL or an array of crate scope patterns (see RFC #2947)
Expand All @@ -25,7 +21,7 @@ index bb2658942..1bc6801ea 100644
/// The `expired_at` column of the `api_tokens` table.
///
/// Its SQL type is `Nullable<Timestamp>`.
@@ -193,12 +191,6 @@ diesel::table! {
@@ -180,12 +178,6 @@
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
Expand All @@ -38,7 +34,7 @@ index bb2658942..1bc6801ea 100644
}
}

@@ -471,7 +463,7 @@ diesel::table! {
@@ -456,7 +448,7 @@
/// Its SQL type is `Array<Nullable<Text>>`.
///
/// (Automatically generated by Diesel.)
Expand All @@ -47,11 +43,10 @@ index bb2658942..1bc6801ea 100644
/// The `target` column of the `dependencies` table.
///
/// Its SQL type is `Nullable<Varchar>`.
@@ -675,6 +667,24 @@ diesel::table! {
}
@@ -683,6 +675,24 @@
}

+diesel::table! {
diesel::table! {
+ /// Representation of the `recent_crate_downloads` view.
+ ///
+ /// This data represents the downloads in the last 90 days.
Expand All @@ -69,11 +64,12 @@ index bb2658942..1bc6801ea 100644
+ }
+}
+
diesel::table! {
+diesel::table! {
/// Representation of the `reserved_crate_names` table.
///
@@ -988,7 +998,8 @@ diesel::joinable!(api_tokens -> users (user_id));
diesel::joinable!(badges -> crates (crate_id));
/// (Automatically generated by Diesel.)
@@ -997,7 +1007,8 @@
diesel::joinable!(api_tokens -> users (user_id));
diesel::joinable!(crate_owner_invitations -> crates (crate_id));
diesel::joinable!(crate_owners -> crates (crate_id));
-diesel::joinable!(crate_owners -> users (created_by));
Expand All @@ -82,15 +78,15 @@ index bb2658942..1bc6801ea 100644
diesel::joinable!(crates_categories -> categories (category_id));
diesel::joinable!(crates_categories -> crates (crate_id));
diesel::joinable!(crates_keywords -> crates (crate_id));
@@ -1001,6 +1012,7 @@ diesel::joinable!(follows -> users (user_id));
@@ -1010,6 +1021,7 @@
diesel::joinable!(publish_limit_buckets -> users (user_id));
diesel::joinable!(publish_rate_overrides -> users (user_id));
diesel::joinable!(readme_renderings -> versions (version_id));
+diesel::joinable!(recent_crate_downloads -> crates (crate_id));
diesel::joinable!(version_downloads -> versions (version_id));
diesel::joinable!(version_owner_actions -> api_tokens (api_token_id));
diesel::joinable!(version_owner_actions -> users (user_id));
@@ -1027,6 +1039,7 @@ diesel::allow_tables_to_appear_in_same_query!(
@@ -1036,6 +1048,7 @@
publish_limit_buckets,
publish_rate_overrides,
readme_renderings,
Expand Down
28 changes: 0 additions & 28 deletions src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,32 +134,6 @@ diesel::table! {
}
}

diesel::table! {
/// Representation of the `badges` table.
///
/// (Automatically generated by Diesel.)
badges (crate_id, badge_type) {
/// The `crate_id` column of the `badges` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
crate_id -> Int4,
/// The `badge_type` column of the `badges` table.
///
/// Its SQL type is `Varchar`.
///
/// (Automatically generated by Diesel.)
badge_type -> Varchar,
/// The `attributes` column of the `badges` table.
///
/// Its SQL type is `Jsonb`.
///
/// (Automatically generated by Diesel.)
attributes -> Jsonb,
}
}

diesel::table! {
use diesel::sql_types::*;
use super::sql_types::Ltree;
Expand Down Expand Up @@ -1031,7 +1005,6 @@ diesel::table! {
}

diesel::joinable!(api_tokens -> users (user_id));
diesel::joinable!(badges -> crates (crate_id));
diesel::joinable!(crate_owner_invitations -> crates (crate_id));
diesel::joinable!(crate_owners -> crates (crate_id));
diesel::joinable!(crate_owners -> teams (owner_id));
Expand Down Expand Up @@ -1060,7 +1033,6 @@ diesel::joinable!(versions_published_by -> versions (version_id));
diesel::allow_tables_to_appear_in_same_query!(
api_tokens,
background_jobs,
badges,
categories,
crate_owner_invitations,
crate_owners,
Expand Down
7 changes: 0 additions & 7 deletions src/worker/jobs/dump_db/dump-db.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ last_retry = "private"
created_at = "private"
priority = "private"

[badges]
dependencies = ["crates"]
[badges.columns]
crate_id = "public"
badge_type = "public"
attributes = "public"

[categories.columns]
id = "public"
category = "public"
Expand Down