From b24598b118c633d58b89a27621085b54c2ffc89b Mon Sep 17 00:00:00 2001 From: kj Date: Mon, 27 Oct 2025 15:15:45 -0300 Subject: [PATCH] fix(sqlite): Correct base table for RIGHT JOIN conversion --- src/Libs/Model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Libs/Model.php b/src/Libs/Model.php index 65d23b6..bb43e80 100644 --- a/src/Libs/Model.php +++ b/src/Libs/Model.php @@ -822,7 +822,10 @@ class Model } if (static::db()->getAttribute(PDO::ATTR_DRIVER_NAME) == 'sqlite') { - return static::leftJoin($table, $columnB, $operatorOrColumnB, $columnA); + $currentTable = empty(static::$querySelect['from']) ? + static::table() : static::$querySelect['from']; + static::$querySelect['from'] = $table; + return static::leftJoin($currentTable, $columnB, $operatorOrColumnB, $columnA); } static::$querySelect['rightJoin'] .= ' RIGHT JOIN ' . $table . ' ON ' . "$columnA$operatorOrColumnB$columnB";