From 607cb2ded24c130ced0a6175c619b4fc0d936ca3 Mon Sep 17 00:00:00 2001 From: Natty Date: Thu, 5 Sep 2024 19:33:57 +0200 Subject: [PATCH] Clarified tables in subselect --- ext_model/src/note_model/mod.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ext_model/src/note_model/mod.rs b/ext_model/src/note_model/mod.rs index 9640657..4166402 100644 --- a/ext_model/src/note_model/mod.rs +++ b/ext_model/src/note_model/mod.rs @@ -47,16 +47,12 @@ impl NoteResolveMode { NoteResolveMode::Multiple(ids) => id_col.is_in(ids), NoteResolveMode::PinsFromUserId(user_id) => { let sub_query = Query::select() - .expr(SelectExpr { - expr: Expr::col(user_note_pining::Column::NoteId).into(), - alias: None, - window: None, - }) + .column(user_note_pining::Column::NoteId) .from(user_note_pining::Entity) - .and_where(Expr::col(user_note_pining::Column::UserId).eq(user_id)) + .and_where(Expr::col((user_note_pining::Entity, user_note_pining::Column::UserId)).eq(user_id)) .order_by_columns([ - (user_note_pining::Column::CreatedAt, Order::Desc), - (user_note_pining::Column::Id, Order::Desc) + ((user_note_pining::Entity, user_note_pining::Column::CreatedAt), Order::Desc), + ((user_note_pining::Entity, user_note_pining::Column::Id), Order::Desc) ]) .take();