Skip to content

Commit

Permalink
Upgrading diesel and a few other deps. (#5203)
Browse files Browse the repository at this point in the history
* Upgrading diesel and a few other deps.

* Update crates/db_schema/src/utils.rs

Co-authored-by: dullbananas <[email protected]>

---------

Co-authored-by: dullbananas <[email protected]>
  • Loading branch information
dessalines and dullbananas authored Nov 18, 2024
1 parent 556358f commit 417e18e
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 181 deletions.
281 changes: 138 additions & 143 deletions Cargo.lock

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ lemmy_federate = { version = "=0.19.6-beta.7", path = "./crates/federate" }
activitypub_federation = { version = "0.6.0-alpha2", default-features = false, features = [
"actix-web",
] }
diesel = "2.1.6"
diesel_migrations = "2.1.0"
diesel-async = "0.4.1"
serde = { version = "1.0.204", features = ["derive"] }
diesel = "2.2.4"
diesel_migrations = "2.2.0"
diesel-async = "0.5.1"
serde = { version = "1.0.215", features = ["derive"] }
serde_with = "3.9.0"
actix-web = { version = "4.9.0", default-features = false, features = [
"macros",
Expand All @@ -113,7 +113,7 @@ actix-web = { version = "4.9.0", default-features = false, features = [
tracing = "0.1.40"
tracing-actix-web = { version = "0.7.10", default-features = false }
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
url = { version = "2.5.2", features = ["serde"] }
url = { version = "2.5.3", features = ["serde"] }
reqwest = { version = "0.12.7", default-features = false, features = [
"json",
"blocking",
Expand All @@ -129,23 +129,23 @@ chrono = { version = "0.4.38", features = [
"serde",
"now",
], default-features = false }
serde_json = { version = "1.0.121", features = ["preserve_order"] }
serde_json = { version = "1.0.132", features = ["preserve_order"] }
base64 = "0.22.1"
uuid = { version = "1.10.0", features = ["serde", "v4"] }
async-trait = "0.1.81"
uuid = { version = "1.11.0", features = ["serde", "v4"] }
async-trait = "0.1.83"
captcha = "0.0.9"
anyhow = { version = "1.0.86", features = [
anyhow = { version = "1.0.93", features = [
"backtrace",
] } # backtrace is on by default on nightly, but not stable rust
diesel_ltree = "0.3.1"
serial_test = "3.1.1"
tokio = { version = "1.39.2", features = ["full"] }
regex = "1.10.5"
serial_test = "3.2.0"
tokio = { version = "1.41.1", features = ["full"] }
regex = "1.11.1"
diesel-derive-newtype = "2.1.2"
diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
strum = { version = "0.26.3", features = ["derive"] }
itertools = "0.13.0"
futures = "0.3.30"
futures = "0.3.31"
http = "1.1"
rosetta-i18n = "0.1.3"
ts-rs = { version = "10.0.0", features = [
Expand All @@ -154,16 +154,16 @@ ts-rs = { version = "10.0.0", features = [
"no-serde-warnings",
"url-impl",
] }
rustls = { version = "0.23.12", features = ["ring"] }
futures-util = "0.3.30"
tokio-postgres = "0.7.11"
rustls = { version = "0.23.16", features = ["ring"] }
futures-util = "0.3.31"
tokio-postgres = "0.7.12"
tokio-postgres-rustls = "0.12.0"
urlencoding = "2.1.3"
enum-map = "2.7"
moka = { version = "0.12.8", features = ["future"] }
i-love-jesus = { version = "0.1.0" }
clap = { version = "4.5.13", features = ["derive", "env"] }
pretty_assertions = "1.4.0"
clap = { version = "4.5.21", features = ["derive", "env"] }
pretty_assertions = "1.4.1"
derive-new = "0.7.0"
diesel-bind-if-some = "0.1.0"
tuplex = "0.1.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ tracing = { workspace = true }
chrono = { workspace = true }
url = { workspace = true }
hound = "3.5.1"
sitemap-rs = "0.2.1"
sitemap-rs = "0.2.2"
totp-rs = { version = "5.6.0", features = ["gen_secret", "otpauth"] }
actix-web-httpauth = "0.8.2"

Expand Down
2 changes: 1 addition & 1 deletion crates/api_common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mime = { version = "0.3.17", optional = true }
webpage = { version = "2.0", default-features = false, features = [
"serde",
], optional = true }
encoding_rs = { version = "0.8.34", optional = true }
encoding_rs = { version = "0.8.35", optional = true }
jsonwebtoken = { version = "9.3.0", optional = true }
# necessary for wasmt compilation
getrandom = { version = "0.2.15", features = ["js"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/apub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ reqwest = { workspace = true }
moka.workspace = true
serde_with.workspace = true
html2md = "0.2.14"
html2text = "0.12.5"
html2text = "0.12.6"
stringreader = "0.1.1"
enum_delegate = "0.2.0"

Expand Down
4 changes: 2 additions & 2 deletions crates/db_perf/src/series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ impl<T, S: SelectableExpression<current_value>> SelectableExpression<T> for Valu

impl<T, S: SelectableExpression<current_value>> Insertable<T> for ValuesFromSeries<S>
where
dsl::BareSelect<Self>: AsQuery + Insertable<T>,
dsl::select<Self>: AsQuery + Insertable<T>,
{
type Values = <dsl::BareSelect<Self> as Insertable<T>>::Values;
type Values = <dsl::select<Self> as Insertable<T>>::Values;

fn values(self) -> Self::Values {
dsl::select(self).values()
Expand Down
3 changes: 1 addition & 2 deletions crates/db_schema/src/impls/community.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
utils::{
action_query,
find_action,
functions::{coalesce, lower},
functions::{coalesce, lower, random},
get_conn,
now,
uplete,
Expand Down Expand Up @@ -211,7 +211,6 @@ impl Community {
type_: &Option<ListingType>,
) -> Result<CommunityId, Error> {
let conn = &mut get_conn(pool).await?;
sql_function!(fn random() -> Text);

let mut query = community::table
.filter(not(community::deleted))
Expand Down
3 changes: 1 addition & 2 deletions crates/db_schema/src/impls/tagline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
schema::tagline::dsl::{published, tagline},
source::tagline::{Tagline, TaglineInsertForm, TaglineUpdateForm},
traits::Crud,
utils::{get_conn, limit_and_offset, DbPool},
utils::{functions::random, get_conn, limit_and_offset, DbPool},
};
use diesel::{insert_into, result::Error, ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
Expand Down Expand Up @@ -53,7 +53,6 @@ impl Tagline {

pub async fn get_random(pool: &mut DbPool<'_>) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
sql_function!(fn random() -> Text);
tagline.order(random()).limit(1).first::<Self>(conn).await
}
}
20 changes: 11 additions & 9 deletions crates/db_schema/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ where
K: CursorKey<C, SqlType = Timestamptz>,
{
type SqlType = sql_types::BigInt;
type CursorValue = functions::reverse_timestamp_sort::HelperType<K::CursorValue>;
type SqlValue = functions::reverse_timestamp_sort::HelperType<K::SqlValue>;
type CursorValue = functions::reverse_timestamp_sort<K::CursorValue>;
type SqlValue = functions::reverse_timestamp_sort<K::SqlValue>;

fn get_cursor_value(cursor: &C) -> Self::CursorValue {
functions::reverse_timestamp_sort(K::get_cursor_value(cursor))
Expand Down Expand Up @@ -486,7 +486,7 @@ pub fn build_db_pool() -> LemmyResult<ActualDbPool> {
// from the pool
let conn_was_used = metrics.recycled.is_some();
if metrics.age() > Duration::from_secs(3 * 24 * 60 * 60) && conn_was_used {
Err(HookError::Continue(None))
Err(HookError::Message("Connection is too old".into()))
} else {
Ok(())
}
Expand Down Expand Up @@ -524,27 +524,29 @@ static EMAIL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
pub mod functions {
use diesel::sql_types::{BigInt, Text, Timestamptz};

sql_function! {
define_sql_function! {
#[sql_name = "r.hot_rank"]
fn hot_rank(score: BigInt, time: Timestamptz) -> Double;
}

sql_function! {
define_sql_function! {
#[sql_name = "r.scaled_rank"]
fn scaled_rank(score: BigInt, time: Timestamptz, users_active_month: BigInt) -> Double;
}

sql_function! {
define_sql_function! {
#[sql_name = "r.controversy_rank"]
fn controversy_rank(upvotes: BigInt, downvotes: BigInt, score: BigInt) -> Double;
}

sql_function!(fn reverse_timestamp_sort(time: Timestamptz) -> BigInt);
define_sql_function!(fn reverse_timestamp_sort(time: Timestamptz) -> BigInt);

sql_function!(fn lower(x: Text) -> Text);
define_sql_function!(fn lower(x: Text) -> Text);

define_sql_function!(fn random() -> Text);

// really this function is variadic, this just adds the two-argument version
sql_function!(fn coalesce<T: diesel::sql_types::SqlType + diesel::sql_types::SingleValue>(x: diesel::sql_types::Nullable<T>, y: T) -> T);
define_sql_function!(fn coalesce<T: diesel::sql_types::SqlType + diesel::sql_types::SingleValue>(x: diesel::sql_types::Nullable<T>, y: T) -> T);
}

pub const DELETED_REPLACEMENT_TEXT: &str = "*Permanently Deleted*";
Expand Down
4 changes: 2 additions & 2 deletions crates/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ uuid = { workspace = true, features = ["serde", "v4"], optional = true }
rosetta-i18n = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }
urlencoding = { workspace = true, optional = true }
html2text = { version = "0.12.5", optional = true }
html2text = { version = "0.12.6", optional = true }
deser-hjson = { version = "2.2.4", optional = true }
smart-default = { version = "0.7.1", optional = true }
lettre = { version = "0.11.8", default-features = false, features = [
lettre = { version = "0.11.10", default-features = false, features = [
"builder",
"tokio1",
"tokio1-rustls-tls",
Expand Down

0 comments on commit 417e18e

Please sign in to comment.