Skip to content

Commit 0c1b77f

Browse files
abnegateclaude
andcommitted
chore(merge): merge feat-query-lib into j-db-fix-65
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 parents 7ddf260 + 746f90d commit 0c1b77f

9 files changed

Lines changed: 23 additions & 51 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ have to make, with the 7.x and 8.0 forms side by side.
321321
- The protected adapter methods nothing called: `getSQLIndexType()` on `SQL` and `SQLite`,
322322
`Postgres::getSQLSchema()`, `Postgres::encodeArray()`, `Postgres::decodeArray()` and
323323
`Memory::unregisterRelationshipField()`. See [Removed adapter methods](UPGRADE.md#removed-adapter-methods).
324+
- `Adapter\SQL::setFloatPrecision()`, `Adapter\SQLite::getEmulateMySQL()`, `Database::getInstanceFilters()`,
325+
`Mirror::getWriteFilters()` and `Validator\Structure::getFormats()`, which nothing calls. See
326+
[Removed unused public methods](UPGRADE.md#removed-unused-public-methods).
324327

325328
### Fixed
326329

‎UPGRADE.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ to 8.0. [CHANGELOG.md](CHANGELOG.md) lists everything that is new in 8.0.
1717
- [Adapters](#adapters)
1818
- [Mirror](#mirror)
1919
- [Validators and helpers](#validators-and-helpers)
20+
- [Removed unused public methods](#removed-unused-public-methods)
2021
- [Rules for features new in 8.0](#rules-for-features-new-in-80)
2122
- [Known limitations](#known-limitations)
2223

@@ -1161,6 +1162,18 @@ in 7.x, ahead of the registered `Transform` hooks.
11611162
too; aggregates and selects in the list are left as they are. Without it the method converts as before.
11621163
- `Utopia\Database\Storage::joinAlias()` returns the alias an undeclared join is read under (`j0`, `j1`, ...).
11631164

1165+
## Removed unused public methods
1166+
1167+
Nothing in the library, Appwrite, Appwrite Cloud or utopia-php/migration calls these 7.x methods.
1168+
1169+
| Removed | Replacement |
1170+
|---|---|
1171+
| `Adapter\SQL::setFloatPrecision(int $precision)` | Floats are bound with 17 digits. A subclass can set the protected `$floatPrecision` property |
1172+
| `Adapter\SQLite::getEmulateMySQL()` | `setEmulateMySQL()` is kept. A subclass reads the protected `$emulateMySQL` property |
1173+
| `Database::getInstanceFilters()` | The `$filters` given to the constructor. A subclass reads the protected `$instanceFilters` property |
1174+
| `Mirror::getWriteFilters()` | The `$filters` given to the constructor. A subclass reads the protected `$writeFilters` property |
1175+
| `Validator\Structure::getFormats()` | `Structure::hasFormat($name, $type)` and `Structure::getFormat($name, $type)` |
1176+
11641177
## Rules for features new in 8.0
11651178

11661179
These features do not exist in 7.x. Their rules are listed here because they differ from what a reader of the 7.x

‎src/Database/Adapter/SQL.php‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,6 @@ public static function getPDOAttributes(): array
220220
];
221221
}
222222

223-
/**
224-
* Configure float precision for parameter binding/logging.
225-
*/
226-
public function setFloatPrecision(int $precision): void
227-
{
228-
$this->floatPrecision = $precision;
229-
}
230-
231223
/**
232224
* Helper to format a float value according to configured precision for binding/logging.
233225
*/

‎src/Database/Adapter/SQLite.php‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,6 @@ public function setEmulateMySQL(bool $emulate): static
213213
return $this;
214214
}
215215

216-
public function getEmulateMySQL(): bool
217-
{
218-
return $this->emulateMySQL;
219-
}
220-
221216
public function setTenant(int|string|null $tenant): bool
222217
{
223218
$changed = $this->currentTenant() !== $tenant;

‎src/Database/Database.php‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,16 +1840,6 @@ public function skipFilters(callable $callback, ?array $filters = null): mixed
18401840
);
18411841
}
18421842

1843-
/**
1844-
* Get instance filters
1845-
*
1846-
* @return array<string, array{encode: callable, decode: callable, signature: string}>
1847-
*/
1848-
public function getInstanceFilters(): array
1849-
{
1850-
return $this->instanceFilters;
1851-
}
1852-
18531843
/**
18541844
* Encode Document
18551845
*

‎src/Database/Hook/Relationships.php‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,6 @@ public function shouldCheckExist(): bool
224224
return $this->checkExist->get();
225225
}
226226

227-
/**
228-
* {@inheritDoc}
229-
*/
230-
public function setCheckExist(bool $check): void
231-
{
232-
$this->checkExist->set($check);
233-
}
234-
235227
/**
236228
* Run the callback with existence checks on or off for the calling coroutine and the coroutines it starts.
237229
*

‎src/Database/Mirror.php‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,6 @@ public function getDestination(): ?Database
129129
return $this->destination;
130130
}
131131

132-
/**
133-
* @return array<Filter>
134-
*/
135-
public function getWriteFilters(): array
136-
{
137-
return $this->writeFilters;
138-
}
139-
140132
/**
141133
* @param callable(string, Throwable): void $callback
142134
*/

‎src/Database/Validator/Structure.php‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,6 @@ public function __construct(
140140
$this->storedAttributes = \array_fill_keys($storedAttributes, true);
141141
}
142142

143-
/**
144-
* Remove a Validator
145-
*
146-
* @return array<string, array{callback: callable, type: string}>
147-
*/
148-
public static function getFormats(): array
149-
{
150-
return self::$formats;
151-
}
152-
153143
/**
154144
* Add a new Validator
155145
* Stores a callback and required params to create Validator

‎tests/unit/Relationships/PreparedCreateTest.php‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ public function testImmediateCreateMatchesOneByOne(string $engine, string $scena
116116
$immediate = $this->observe($engine, self::IMMEDIATE, $scenario);
117117

118118
if (isset($immediate['thrown']) && $immediate['inputs'] !== $oneByOne['inputs']) {
119-
$this->assertSame(\array_slice($immediate['given'], 1), \array_slice($immediate['inputs'], 1), 'A failed write left the related documents it was given changed');
119+
$given = $immediate['given'];
120+
$inputs = $immediate['inputs'];
121+
if (! \is_array($given) || ! \is_array($inputs)) {
122+
$this->fail('An observation lacks the documents handed in');
123+
}
124+
$this->assertSame(\array_slice($given, 1), \array_slice($inputs, 1), 'A failed write left the related documents it was given changed');
120125
unset($oneByOne['inputs'], $immediate['inputs']);
121126
}
122127

@@ -679,7 +684,7 @@ private function stored(Database $database): array
679684
$stored = [];
680685
foreach ($collections as $collection) {
681686
$rows = $database->find($collection, [Query::limit(1000), Query::orderAsc('$sequence')]);
682-
$stored[$collection] = \array_map($this->export(...), $rows);
687+
$stored[$collection] = \array_values(\array_map($this->export(...), $rows));
683688
}
684689

685690
return $stored;

0 commit comments

Comments
 (0)