Skip to content
Open

Joins #133

Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1d86a6b
Migration
fogelito Dec 22, 2025
ae04b11
Migration
fogelito Dec 22, 2025
98dd145
select
fogelito Dec 22, 2025
01e06cf
fallback query select
fogelito Dec 23, 2025
6a95abb
4.5.2
fogelito Jan 15, 2026
f2c5f6a
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Jan 15, 2026
53ce92c
pull main
fogelito Jan 15, 2026
67c8eda
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Jan 18, 2026
69ade1c
Update lock
fogelito Jan 18, 2026
066bd70
lock
fogelito Jan 18, 2026
49bddeb
database 4.5.2
fogelito Jan 18, 2026
f50c5ad
fix many2many
fogelito Jan 18, 2026
805bdb8
append queries
fogelito Jan 18, 2026
317e4c9
DB 4.6.2
fogelito Jan 28, 2026
bfafb18
lock
fogelito Jan 28, 2026
525ba8c
lock
fogelito Jan 28, 2026
bc73611
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Jan 28, 2026
fb8378a
lock
fogelito Jan 28, 2026
fd6b9bc
SDK original
fogelito Jan 28, 2026
4030ff3
database 5.0
fogelito Feb 2, 2026
daa5f17
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Feb 8, 2026
0a632aa
Update main
fogelito Feb 8, 2026
d115b61
Fix codeQL
fogelito Feb 8, 2026
9aeb2d5
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Feb 11, 2026
ac60b6d
update main
fogelito Feb 11, 2026
4582154
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Feb 18, 2026
db744ef
Update database 5.3.1
fogelito Feb 18, 2026
6817db3
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Mar 2, 2026
b1c5095
Update lock
fogelito Mar 2, 2026
63df4dd
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Mar 18, 2026
3a33326
database subquery
fogelito Mar 19, 2026
e60685a
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Mar 19, 2026
7b1750f
database subqueries + update
fogelito Mar 19, 2026
19feff6
Fix this reader
fogelito Mar 23, 2026
b41b305
Fix this reader
fogelito Mar 23, 2026
32da357
Merge branch 'main' of https://github.com/utopia-php/migration into j…
fogelito Apr 6, 2026
c030a2a
pull main
fogelito Apr 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"ext-curl": "*",
"ext-openssl": "*",
"appwrite/appwrite": "19.*",
"utopia-php/database": "4.*",
"utopia-php/database": "dev-joins8 as 4.5.2",
Comment thread
fogelito marked this conversation as resolved.
Outdated
"utopia-php/storage": "0.18.*",
"utopia-php/dsn": "0.2.*",
"utopia-php/console": "0.0.*"
Expand Down
94 changes: 51 additions & 43 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Migration/Resources/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(
* updatedAt: string,
* enabled: bool,
* originalId: string|null,
* type: string|null,
* } $array
*/
public static function fromArray(array $array): self
Expand Down
4 changes: 3 additions & 1 deletion src/Migration/Sources/Appwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,9 @@ private function exportRows(int $batchSize): void
}
/** @var Column|Relationship $attribute */

$queries[] = $this->database->querySelect($selects);
foreach ($selects as $select) {
$queries[] = $this->database->querySelect($select);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Stale PHPDoc annotation causes pipeline failure.

The @var Column|Relationship $attribute annotation at line 1144 references $attribute, but the subsequent loop iterates over $selects/$select. This is flagged by PHPStan.

Remove or relocate the stale PHPDoc comment.

🔎 Proposed fix
-                /** @var Column|Relationship $attribute */
-
                 foreach ($selects as $select) {
                     $queries[] = $this->database->querySelect($select);
                 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/** @var Column|Relationship $attribute */
$queries[] = $this->database->querySelect($selects);
foreach ($selects as $select) {
$queries[] = $this->database->querySelect($select);
}
foreach ($selects as $select) {
$queries[] = $this->database->querySelect($select);
}
🧰 Tools
🪛 GitHub Actions: CodeQL

[error] 1146-1146: PHPStan: Variable $attribute in PHPDoc tag @var does not match any variable in the foreach loop: $selects, $select

🤖 Prompt for AI Agents
In @src/Migration/Sources/Appwrite.php around lines 1144 - 1148, The stale
PHPDoc "@var Column|Relationship $attribute" above the foreach is incorrect
because the loop iterates over $selects as $select; remove the erroneous PHPDoc
or relocate it to the actual context where $attribute is used (e.g., the block
that handles $attribute variables), and ensure the foreach uses no misleading
docblock so PHPStan no longer flags $attribute in the scope of the foreach over
$selects/$select.


$response = $this->database->listRows($table, $queries);

Expand Down
5 changes: 3 additions & 2 deletions src/Migration/Sources/Appwrite/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Utopia\Migration\Sources\Appwrite;

use Utopia\Database\Query;
use Utopia\Migration\Resource;
use Utopia\Migration\Resources\Database\Database;
use Utopia\Migration\Resources\Database\Table;
Expand Down Expand Up @@ -78,10 +79,10 @@ public function getRow(Table $resource, string $rowId, array $queries = []): arr
/**
* Return a query to select the given attributes
*
* @param array $columns
* @param string $column
* @return QueryType|string
*/
public function querySelect(array $columns): mixed;
public function querySelect(string $column): mixed;
Comment thread
fogelito marked this conversation as resolved.

/**
* Return a query to filter the given attributes
Expand Down
13 changes: 9 additions & 4 deletions src/Migration/Sources/Appwrite/Reader/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,17 @@ public function getRow(Table $resource, string $rowId, array $queries = []): arr
}

/**
* @param array $columns
* @return string
* @param string $column
* @return Query
*/
public function querySelect(array $columns): string
public function querySelect(string $column): string
{
return Query::select($columns);
return new Query('select', $column);

/**
* todo fix Query::select to get attribute not array
*/
return Query::select($column);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Migration/Sources/Appwrite/Reader/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ public function getRow(TableResource $resource, string $rowId, array $queries =
}

/**
* @param array $columns
* @param string $column
* @return Query
*/
public function querySelect(array $columns): Query
public function querySelect(string $column): Query
{
return Query::select($columns);
return Query::select($column);
}
Comment thread
fogelito marked this conversation as resolved.
Comment on lines 421 to 423
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Query::select() expects an array, not a bare string

Utopia\Database\Query::select() expects an array of attribute names. Passing the column string directly (without wrapping it in an array) is inconsistent with the API.php reader which correctly uses Query::select([$column]). Passing a bare string may result in incorrect query construction or a type error at runtime.

Suggested change
{
return Query::select($columns);
return Query::select($column);
}
public function querySelect(string $column): Query
{
return Query::select([$column]);
}


/**
Expand Down
Loading