From 9c03dcaa8837bdcca29bb1a27628168e401d6ddc Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 22 Nov 2024 09:27:45 -0500 Subject: [PATCH] Switching from bigint to smallint. --- crates/db_schema/src/aggregates/structs.rs | 8 ++++---- crates/db_schema/src/schema.rs | 8 ++++---- migrations/2024-11-21-195004_add_report_count/up.sql | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/db_schema/src/aggregates/structs.rs b/crates/db_schema/src/aggregates/structs.rs index 6fa744588..7a97666aa 100644 --- a/crates/db_schema/src/aggregates/structs.rs +++ b/crates/db_schema/src/aggregates/structs.rs @@ -39,8 +39,8 @@ pub struct CommentAggregates { pub hot_rank: f64, #[serde(skip)] pub controversy_rank: f64, - pub report_count: i64, - pub unresolved_report_count: i64, + pub report_count: i16, + pub unresolved_report_count: i16, } #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] @@ -148,8 +148,8 @@ pub struct PostAggregates { /// A rank that amplifies smaller communities #[serde(skip)] pub scaled_rank: f64, - pub report_count: i64, - pub unresolved_report_count: i64, + pub report_count: i16, + pub unresolved_report_count: i16, } #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] diff --git a/crates/db_schema/src/schema.rs b/crates/db_schema/src/schema.rs index 0d2f2bad3..f2b186d35 100644 --- a/crates/db_schema/src/schema.rs +++ b/crates/db_schema/src/schema.rs @@ -130,8 +130,8 @@ diesel::table! { child_count -> Int4, hot_rank -> Float8, controversy_rank -> Float8, - report_count -> Int8, - unresolved_report_count -> Int8, + report_count -> Int2, + unresolved_report_count -> Int2, } } @@ -779,8 +779,8 @@ diesel::table! { controversy_rank -> Float8, instance_id -> Int4, scaled_rank -> Float8, - report_count -> Int8, - unresolved_report_count -> Int8, + report_count -> Int2, + unresolved_report_count -> Int2, } } diff --git a/migrations/2024-11-21-195004_add_report_count/up.sql b/migrations/2024-11-21-195004_add_report_count/up.sql index 327a981ed..c7d28e1ef 100644 --- a/migrations/2024-11-21-195004_add_report_count/up.sql +++ b/migrations/2024-11-21-195004_add_report_count/up.sql @@ -1,12 +1,12 @@ -- Adding report_count and unresolved_report_count -- to the post and comment aggregate tables ALTER TABLE post_aggregates - ADD COLUMN report_count bigint NOT NULL DEFAULT 0, - ADD COLUMN unresolved_report_count bigint NOT NULL DEFAULT 0; + ADD COLUMN report_count smallint NOT NULL DEFAULT 0, + ADD COLUMN unresolved_report_count smallint NOT NULL DEFAULT 0; ALTER TABLE comment_aggregates - ADD COLUMN report_count bigint NOT NULL DEFAULT 0, - ADD COLUMN unresolved_report_count bigint NOT NULL DEFAULT 0; + ADD COLUMN report_count smallint NOT NULL DEFAULT 0, + ADD COLUMN unresolved_report_count smallint NOT NULL DEFAULT 0; -- Update the historical counts -- Posts