From 191e2f0c57839c0d4b6ccdbe7645848c8d49c99c Mon Sep 17 00:00:00 2001 From: dull b Date: Wed, 20 Dec 2023 21:20:56 +0000 Subject: [PATCH] different timestamps --- crates/db_perf/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/db_perf/src/main.rs b/crates/db_perf/src/main.rs index d071779a9..6a23e0113 100644 --- a/crates/db_perf/src/main.rs +++ b/crates/db_perf/src/main.rs @@ -1,5 +1,5 @@ use clap::{Parser, Subcommand}; -use diesel::{dsl, sql_query, sql_types, ExpressionMethods, IntoSql}; +use diesel::{dsl::{self, sql}, sql_query, sql_types, ExpressionMethods, IntoSql}; use diesel_async::RunQueryDsl; use lemmy_db_schema::{ schema::post, @@ -12,7 +12,7 @@ use lemmy_db_schema::{ utils::{ build_db_pool, get_conn, - series::{self, ValuesFromSeries}, DbConn, DbPool, + series::{self, ValuesFromSeries}, DbConn, DbPool, now, }, SortType, }; @@ -22,6 +22,7 @@ use lemmy_db_views::{ }; use lemmy_utils::error::LemmyResult; use std::num::NonZeroU32; +use diesel::pg::expression::dsl::IntervalDsl; #[derive(Parser, Debug)] struct CmdArgs { @@ -107,6 +108,7 @@ async fn main() -> LemmyResult<()> { person_id.into_sql::(), community_id.into_sql::(), series::current_value.eq(1), + now() - sql::("make_interval(secs => ").bind::(series::current_value).sql(")"), ), }) .into_columns(( @@ -114,6 +116,7 @@ async fn main() -> LemmyResult<()> { post::creator_id, post::community_id, post::featured_community, + post::published, )) .execute(&mut get_conn(pool).await?) .await?;