8.1.4 fixes deleteDocuments() deleting documents that stopped matching its queries after they were found. It needs
no code change; a custom adapter can opt in to the fix, see
Upgrading from 8.1.3 to 8.1.4.
Adapter::deleteDocumentsMatching(Document $collection, array $sequences, array $permissionIds, array $queries): intdeletes the rows of$sequencesthat match every filter query in$queries, asfind()is handed them, removes the permission rows of$permissionIdsbut those of a row kept because it no longer matches, and returns the number of rows deleted. It callsdeleteDocuments()with the queries readable through the new protectedAdapter::deletionFilters(), so an override ofdeleteDocuments()still runs, on aPooltoo. Memory, SQLite, MariaDB, MySQL, PostgreSQL, MongoDB and Redis delete only the rows that match them;PoolandReadWritePoolhand them to the pooled adapter. A custom adapter that ignores them deletes every row of$sequences, as before.
deleteDocuments()deletes only the documents that still match its filters when each batch is deleted. It found a batch and then deleted it by internal id alone, so a document another write changed in between, so that it no longer matched (such as a presence refreshed before an expired-presence cleanup deleted it), was deleted anyway, cascaded to its related documents, lost its permission rows, and was counted and handed toonNext. Each batch with filters on anything but$sequencenow reads its documents again, with the same queries, in the transaction that deletes them, and deletes them withAdapter::deleteDocumentsMatching(). A document that no longer matches is kept with its related documents and permission rows, and is neither counted, handed toonNextnor inEvent::DocumentsDelete's count. A limit counts the documents found, kept ones included, so a kept document is not replaced by a later one. When a document changes between that read and the delete, the batch is rolled back and tried again, and fails withException\Contentiononce the transaction's retries are spent; the batches before it stay deleted andEvent::DocumentsDeletereports them. In a transaction begun withstartTransaction()the retry runs in a savepoint, which on MySQL and MariaDB reads the transaction's snapshot again and fails the same way; a MongoDB replica set has no savepoints, so the batch is not retried and its partial delete stays in the transaction. Either way the caller rolls the whole transaction back and runs it again. Without transactions, as on a standalone MongoDB server, nothing is rolled back: the documents still stored are kept and left out of the count,onNext, the cache purges and the event, the remaining batches are deleted, a document another deleter removed meanwhile is counted by this call, and a cascade that already ran for a kept document stays, so cascades are best-effort there. The adapter's count is a hint: only a document of the batch still stored after the delete counts as changed, so a custom adapter that reports a wrong count does not fail the delete. A delete without filters, or with filters only on$sequence, runs as before.- A bulk delete on SQLite, MariaDB, MySQL and PostgreSQL binds the floats of its filters in fixed-point notation, as
find()binds them, so it matches the rows the find matched.
8.1.3 adds a hook that rewrites the queries of a read. It changes nothing for a database without one; see Upgrading from 8.1.2 to 8.1.3.
Hook\Queries::rewrite(Event $event, Collection $collection, array $queries): arrayrewrites the queries of a read, registered withaddHook()and removed withremoveHook(). It is given the queries one read was given and the definition of the collection being read, once each query is checked to be aQueryand before the read checks its queries any further: before it validates, parses or authorizes them or resolves their joins. The queries it returns replace the read's queries for the rest of the read, the query-cache key included. It runs forgetDocument()(Event::DocumentRead),find()and sofindOne(),cursor()andresolveCursor()(Event::DocumentFind),count()(Event::DocumentCount),sum()(Event::DocumentSum) andaggregate()(Event::DocumentAggregate). Hooks run in registration order, each given the previous one's output. Throwing refuses the read, with the exception reaching the caller unchanged before anything is read. It also runs on the reads such a read makes itself: relationship population, the reads that resolve queries on relationship attributes,findOne()throughfind(), eachcursor()page andresolveCursor()'s read of the joined row it pairs with the document. So it must return the same queries when given its own output; it runs whether or not events are silenced. It never runs for reads ofDatabase::METADATA, for thequery(),mutate()andfrom()builders, or for writes and the reads they make themselves. The writes arecreateDocument(),createDocuments(),updateDocument(),updateDocuments(),upsertDocument(),upsertDocuments(),increaseDocumentAttribute(),decreaseDocumentAttribute(),deleteDocument()anddeleteDocuments(), and theauthorizeCreate(),authorizeUpdate()andauthorizeGrants()checks of a later write; their own reads load the documents they change, read back the ones they wrote, populate the relationships of the documents they return, and check, link and cascade related documents, so a hook that hides rows never hides them from a write's permission and relationship checks. A read the caller's own code makes while a write runs, such as in anonNextcallback, runs it. With such a hook registered,cursor()resolves the collection and rewrites its queries when it is called, so a missing collection or a refusal throws then instead of when the generator is iterated. AMirrorruns it once on each of its own reads and never on its destination's. One that is also aHook\Lifecycleis registered on the source too, as every lifecycle hook is, so it also rewrites the reads made on the source directly, except the reads the mirror's writes make there.
8.1.2 removes public API that nothing outside the library needed, replaces the opt-in emulation of 7.4.1's fractional arithmetic on integer attributes with one rounding rule that always applies, and moves the update models into the namespace of the model they update. Every entry under Removed and Changed (breaking) needs a code change; see Upgrading from 8.1.1 to 8.1.2 for each replacement.
Database::read(), added in 8.1.0. Callfind()for documents andaggregate()for aggregate orgroupBy()queries;Query::groupByType($queries)->isAggregation()tells which of the two a list is.find()still refuses aggregate andgroupBy()queries.Database::rawQuery(). UseDatabase::query(new Utopia\Query\Builder\Statement($query, $bindings)), which runs the same statement under the same authorization guard.Feature\RawQueryand the adapters'rawQuery()stay.Database::getRelationshipHook(). Keep theHook\Relationshipsgiven toaddHook().Database::getMaxIndexLength(),getMaxVarcharLength(),getMinDateTime()andgetMaxDateTime(). ReadindexLength,varchar,minDateTimeandmaxDateTimefrom$database->getAdapter()->limits().Database::getCacheWriterTimeout().Database::setRoundFractions(),isRoundingFractions()andwithRoundFractions(), with theMirroroverrides. Integer rounding is always on (listed under Changed).Adapter::arithmetic()and its overrides inPostgres,Mongo,SQLite,Memory,RedisandPool;ReadWritePoolno longer lists it among the methods it answers wherever reads go.Utopia\Database\Arithmetic,Utopia\Database\Arithmetic\Roundingand the internalArithmetic\DecimalandArithmetic\Fractional.- The trailing
bool $fractionsargument ofValidator\OperatorandValidator\Structure(and soValidator\PartialStructure). - The trailing
bool $roundFractionsargument of theState\Snapshotconstructor. Event\Permission\Created,ReadandDeleted, whichDatabasenever dispatched.Event::PermissionsCreate,PermissionsReadandPermissionsDeletestay as statement labels; theirdomain()isnull.Adapter\SQL\Hook\Permission\AllowNullUid. UseAdapter\SQL\Hook\Column\AllowNull, which it wrapped.
-
The update models moved into the namespace of the model they update. Replace the imports:
8.1.1 8.1.2 Utopia\Database\AttributeUpdateUtopia\Database\Attribute\UpdateUtopia\Database\CollectionUpdateUtopia\Database\Collection\UpdateUtopia\Database\RelationshipUpdateUtopia\Database\Relationship\UpdateTheir constructors and fields are unchanged.
- On a single-valued integer or big integer attribute,
increaseDocumentAttribute()anddecreaseDocumentAttribute()round a fractional change half away from zero (1.5 adds 2, 2.5 subtracts 3), floor a fractionalmaxand ceil a fractionalmin;Operator::increment()andOperator::decrement()given toupdateDocument(),updateDocuments(),upsertDocument()andupsertDocuments()round their amount and limit the same way, soincrement(-2.5)subtracts 3. Rounding happens once, in PHP, before validation and on every adapter alike. Decimal text, which is whatis_numeric()accepts without an exponent, such as'9007199254740993.5',' +.5'or'1.', is rounded exactly at any size; text with an exponent is refused. A change that rounds to 0, such as 0.4, changes nothing and skips themaxormincheck: a counter writes nothing and fires no event, and an operator is dropped from the update, soupdateDocuments()with nothing else to change returns 0. Before, these were refused, unlesssetRoundFractions(true)stored what the adapter's engine stored on 7.4.1. - Refused with
Exception\Structure, as in 8.0.3 and in 8.1.1 withoutsetRoundFractions(true): a fractional amount or limit ofmultiply(),divide(),modulo()orpower()on an integer attribute, and a fractional item added to an integer array.setRoundFractions(true)resolved the operators and cut the array items toward zero. Float and double attributes are unchanged.
Adapter\Pool::getPool(): Utopia\Pools\Poolreturns the pool of adapters the handle borrows from.
Adapter\Pool::hostname()returns the hostname given tosetHostname()when it is not empty, and asks the pooled adapter only otherwise. 8.1.1 ignored it, soDatabase::getHostname()and the cache keys built from it named the pooled adapter's host instead.ReadWritePoolalso follows a hostname set after its first answer.
Database::authorizeGrants(string $collection, Document $document, ?callable $resolve = null): voidruns only the grant check ofauthorizeCreate()andauthorizeUpdate(), and writes nothing. It refuses a related document given as a document that adds a permission for a role the caller does not hold, with the sameException\Authorization(Permissions must be one of: (<roles>)), and malformed permissions with the sameException\Structure. Related documents are first prepared by theHook\Nestedhooks, and$resolvegives their staged view, as forauthorizeCreate(). It checks no create or update permission on the collection, the document or any related collection or document, so a caller can report an unheld grant before those checks, such as for a staged upsert.$documentis the document or the changes a later write would be given. It does nothing, and reads nothing, unless grants are checked (setCheckGrants(true)), authorization is enabled and the relationship hook is attached and enabled; while they are, a missing collection throwsException\NotFound.
8.1.0 adds opt-in and additive APIs for work that callers had to do themselves. With no Hook\Nested hook registered
and with setCheckGrants() and setRoundFractions() off, which is the default, a Database behaves exactly as in
8.0.3, except that it runs a join on the parent side of a one-to-many relationship attribute, which 8.0.3 refused
(listed under Changed). See Upgrading from 8.0 to 8.1.
Utopia\Database\Hook\Nested, a hook withprepare(Document $collection, Document $document): Document. Register it withDatabase::addHook()and remove it withremoveHook(). It is given a copy of each related document thatcreateDocument(),createDocuments(),updateDocument(),upsertDocument(),upsertDocuments(),authorizeCreate()orauthorizeUpdate()is given as a document, at every depth the write relates. A parent is prepared before its children, and hooks run in the order they were registered. The write checks grants on, and relates, the document the hook returns. The hook is not given the top-level document, a related document given as an ID, or anything fromupdateDocuments(). AMirrorruns it on itself, for the pre-checks, and on its source. Its destination receives the IDs the source wrote.Database::setCheckGrants(bool $check): static,isCheckingGrants(): boolandwithCheckGrants(bool $check, callable $callback): mixed, off by default. While on and while authorization is enabled, a related document given as a document tocreateDocument(),createDocuments(),updateDocument(),upsertDocument(),upsertDocuments(),authorizeCreate()orauthorizeUpdate()may add permissions only for roles the caller holds. The check judges the document theHook\Nestedhooks return. A related document whose$idaHook\Nestedhook assigned is judged new: none of its permissions are read or locked, and it needs create permission. An unheld role throwsException\Authorization(Permissions must be one of: (<roles>)) and malformed permissions throwException\Structure, before anything is written.- While grants are checked,
updateDocuments()refuses a related document given as a document withException\Relationship(Invalid relationship value. A bulk update takes related documents by ID while grants are checked.). Related documents given by ID still link. Database::setRoundFractions(bool $round): static,isRoundingFractions(): boolandwithRoundFractions(bool $round, callable $callback): mixed, off by default. While on, a fractional change, amount or limit on a single-valued integer or big integer attribute is stored as the adapter's engine stored it on 7.4.1, instead of being refused. This coversincreaseDocumentAttribute(),decreaseDocumentAttribute()and the numeric operators ofupdateDocument(),updateDocuments(),upsertDocument()andupsertDocuments(). Fractional items added to an integer array are cut toward zero. What the engine refused is still refused.Adapter::arithmetic(): Arithmeticdeclares how the adapter's engine stored a fractional result in an integer column on 7.4.1. The base answer is MariaDB's and MySQL's.Postgres,Mongo,SQLite,MemoryandRedisoverride it.Poolasks the pooled adapter once per pool, andReadWritePoolanswers it wherever reads go, without opening the sticky window.Utopia\Database\Arithmetic, afinal readonlyclass:new Arithmetic(Rounding $counter, Rounding $operators, Rounding $division, Rounding $power, bool $refusesCounterFractions = false, array $exactOperators = [], array $refusedWithoutLimit = [], bool $truncatesModulus = false), androunding(OperatorType $method, bool $whole): Rounding.Utopia\Database\Arithmetic\Rounding, an enum with the casesHalfEven,HalfAwayFromZeroandTowardZero, and the methodsapply(int|string $base, float $fraction): int|string,round(float $value): int|stringandratio(int|string $numerator, int|string $denominator): int|string.Validator\OperatorandValidator\Structure(and soValidator\PartialStructure) take a trailingbool $fractions = false. When it is set, a numeric operator on an integer attribute may carry a finite fractional amount or limit within the attribute's range, for a caller that resolves it into a whole one before writing.Database::resolveCursor(string $collection, string $id, CursorDirection $direction, array $queries = []): Documentreturns the cursor that a list with$queriespages from when it names a document by ID. The document is read with authorization skipped, and only the cursor fields are returned:$id,$sequence,$collectionand the values the list orders by, including values from joined rows. Pass the result only tocursorAfter()orcursorBefore(). It returns an emptyDocumentwhen no document has the ID.Database::read(string $collection, array $queries = [], PermissionType $forPermission = PermissionType::Read): arrayreturns a list ofDocument. For aggregate orgroupBy()queries these are the rows ofaggregate(); otherwise they are whatfind()returns. Aggregate queries under a permission other than read throwException\Query.find()still refuses aggregate queries.ParsedQuery::isAggregation(): booltells whether the queries aggregate or group.- The
State\Snapshotconstructor takes two more trailing arguments,bool $checkGrants = falseandbool $roundFractions = false.Database::snapshot()fills them in.
- A join condition whose left column is the parent side of a one-to-many relationship of the main collection, such
as
Query::on('orders', '$id'), compares the main$idwith the relationship's two-way key in the joined collection. The condition keeps its operator.getDocument(),find(),findOne(),read(),aggregate(),count(),sum()andresolveCursor()run it; 8.0.3 refused it withCannot join on virtual relationship attribute. The joined collection is read under the same permission and tenant rules as any join. The child side of a one-to-many and every other relationship type join, or are refused, as before.
Database::authorizeCreate()andDatabase::authorizeUpdate()take an optional resolver,?callable $resolve = null, so a write staged after other writes is judged as it will run, after them.$resolve(string $collection, string $id): ?Documentreturns a related document as the earlier staged writes leave it: the document with its permissions (whether or not the caller can read it), an emptyDocumentwhen they delete it, ornullwhen they leave it as stored. Every related-document lookup of the checks uses it: a document staged for deletion is new to the write and needs create on its collection, a staged update or create is judged by its staged permissions and links, and anullanswer reads the stored document as before. Without$resolvethe checks are unchanged, and they still write nothing.
8.0.1 reverted six deliberate 8.0.0 changes as if they were regressions. 8.0.2 brings them back; everything else in 8.0.1 stays.
- On PostgreSQL an exact search (
search('title', '"foo bar"')) matches the adjacent phrase again, as on MariaDB, MySQL, SQLite, MongoDB, Memory and Redis, andnotSearch()with an exact term excludes only that phrase. 8.0.1 reverted it to every word in any order by mistake. Words in a search term are still split on every character other than a letter, a number or an underscore, as in 7.x (foo/barandfoo,barsearchfooandbar). increaseDocumentAttribute()anddecreaseDocumentAttribute()refuse a fractional change value,maxorminon an integer attribute withException\Typeagain, before anything is written, and a change value of 0 or less throwsException\Type(Value must be numeric and greater than 0) again, whichcatch (DatabaseException)catches. 8.0.1 passed fractional values to the engine (rounded on MariaDB and MySQL, truncated on MongoDB, an error on PostgreSQL) and threw\InvalidArgumentExceptionby mistake.- Numeric operators on integer attributes refuse a fractional
maxorminlimit withException\Structureagain, as 8.0.0 did. Numeric text such aspower('2')stays accepted. 8.0.1 accepted fractional limits by mistake. - The
UIDvalidator description names every character it accepts again (a-z, A-Z, 0-9, period, hyphen, and underscore, none of the last three leading). 8.0.1 returned 7.x's text, which leaves out periods and hyphens. - An update does not validate again the stored values it leaves unchanged, whatever their type, so a value stored before a range, enum or other rule was narrowed never blocks an update of another attribute. 8.0.1 validated them again (leaving only object values alone) by mistake.
document_purgefires after the outermost transaction commits again, and never for a write that rolled back. The cache entry is still purged inside the write's transaction, so a cache failure rolls the write back. 8.0.1 fired the event just before the commit by mistake.
8.0.1 restores the 7.4.1 behaviour that 8.0.0 changed for callers of features 7.x already had. New 8.0 features are unchanged. It also holds nested relationship links to the permission rule UPGRADE.md states.
Database::authorizeCreate(string $collection, Document $document)andDatabase::authorizeUpdate(string $collection, Document $old, Document $document)run the permission checks of a latercreateDocument()orupdateDocument()without writing: create on the collection (update on the document for an update, document-level under document security) and, when the relationship hook is attached and enabled, every nested related document as deep as the write relates it. They throwException\Authorizationwith the reason the write would give. Use them to refuse a write you stage to run later, such as a transaction operation, when it is staged.
- Query validation reports what 7.x reported: the children of
and(),or()andelemMatch()are validated before the query itself, the first invalid query in reading order sets the message even when a later one does not parse, a method 7.x could not parse that no validator takes readsInvalid query: Invalid query method: <method>, and a raw query from a string readsInvalid query method: raw. select('$tenant')passes query validation again without shared tables, and the read refuses it withCannot select attributes: $tenant, as in 7.x.- The
UIDvalidator description is the 7.x text again, also insideInvalid cursor: …. Reverted in 8.0.2. - On PostgreSQL an exact search (
"foo bar") matches every word in any order again, not the adjacent phrase. Reverted in 8.0.2: this was a deliberate 8.0.0 change. containsAll()on an attribute that is not an array matches each value as a whole-valueLIKE(ILIKEon PostgreSQL) pattern, any of them, on MariaDB, MySQL and PostgreSQL, as in 7.x.- A read whose orders include
orderRandom()ignores its cursor instead of failing withOrder attribute '' is empty. document_purgefires inside the write's outermost transaction, just before it commits, so a listener that throws rolls the write back and its failure reaches the caller, as in 7.x. Reverted in 8.0.2.increaseDocumentAttribute()anddecreaseDocumentAttribute()pass a fractional change,maxorminon an integer attribute to the engine again and return the exact sum, and refuse a change that is not above zero with\InvalidArgumentException, as in 7.x. Reverted in 8.0.2.- Numeric operators on integer and double attributes are checked as in 7.x: a fractional change or limit, or a fractional item appended to an integer array, is no longer refused. Reverted in 8.0.2.
- A mismatched attribute default reads
Default value x does not match given type <type>(andis not a valid integer string for type bigint) without JSON quoting, as in 7.x. Index::fromArray()refuses an unknown index type withException\Index(Unknown index type: …) instead of creating a key index.Exception\Unique::MESSAGEisUnique index violationagain.- A many-to-many relationship created by 7.x can be renamed again: its junction index, which 7.x stored with
keyindex_<key>, is read under its$id_index_<key>. - The SQL adapters bind floats as 7.x did: fixed-point only in
find(), as PHP writes them elsewhere, so a write no longer stores1e-300or-2.5e-20as0. - Two-level relationship selects (
author.profile.*,tags.books.name) return the related documents' attributes as in 7.x, andselect(['*', '*.*'])reads every column instead of failing on MariaDB, MySQL and PostgreSQL. - A single read returns
$sequenceahead of$id, in 7.x's key order, on every adapter. - An update validates the stored values it leaves unchanged again, as 7.x did; a stored object value is held to 7.x's object rules. Reverted in 8.0.2.
- On MongoDB a transaction that lost a write conflict runs again up to 20 times, so concurrent increments of one document all land.
- With dates preserved, linking existing children through their one-to-many parent keeps each child's stored
$updatedAt, as 7.x did; unlinking still stamps the child. - Linking a stored related document by ID needs update permission on it for every relationship type, as UPGRADE.md states: a one-way one-to-one link, a many-to-one link and a one-to-many child pointing at its parent linked with read permission alone in 8.0.0, as in 7.x.
- A nested write refuses a stored related document the caller cannot read with
Exception\Authorization: with the read check's reason when it is given by ID, with the update check's reason (or the read check's when the caller may update) when it is given as a document. 8.0.0 left a half link to it (one-to-one, many-to-one), dropped it silently (one-to-many, many-to-many) or tried to create it, failing withException\Duplicate. - A stored two-way one-to-one or one-to-many related document given as a document in a new parent is linked to it; 8.0.0 and 7.x updated it but left its reference to the parent empty.
8.0 is a major release. Read UPGRADE.md before you upgrade from 7.x: it lists every change you may have to make, with the 7.x and 8.0 forms side by side.
- Document permissions and relationships are hooks, and a
Databaseregisters neither on its own: addHook\PermissionsandHook\RelationshipswithaddHook(). See Register the permission and relationship hooks. - The string constants of
Database,Query,OperatorandDocumentare replaced by enums, and the methods that took or returned those strings take or return enum cases.Query::getMethod()returns aUtopia\Query\Methodcase, so a comparison with a string is alwaysfalse. See Constants are now enums and Queries. Helpers\ID,Helpers\PermissionandHelpers\RoleareUtopia\Database\Id,PermissionandRole;Mirroring\FilterisMirror\Filter; several validators moved. No aliases are kept. See Namespaces.- The schema methods take and return value objects:
createCollection(Collection),createAttribute(string, Attribute),createIndex(string, Index),createRelationship(string, Relationship), andupdateAttribute(),updateCollection()andupdateRelationship()takeAttributeUpdate,CollectionUpdateandRelationshipUpdate.Attribute,IndexandRelationshiparefinal readonlywith private constructors and a factory per type;Collection::create()builds a collection.getCollection()throwsException\NotFoundfor a missing collection, andfindCollection()returnsnull.updateAttributeRequired(),updateAttributeFormat(),updateAttributeFormatOptions(),updateAttributeFilters()andupdateAttributeDefault()are removed. See Schema: value objects. - Stored attribute values are normalised per type (datetime
signed: false; integersize0 or 8; boolean, double and idsize: 0; stringssigned: true), fulltext and TTL indexes store noorders, fulltext indexes nolengths, and an index other than TTL no longer storesttl: 1.Attribute::fromDocument()andIndex::fromDocument()read 7.x metadata with the same normalisation, so a legacy attribute or index equals the one 8.0 creates. - A stored attribute of an unknown type (
uuid7included) or a stored relationshiponDeleteofsetDefaultornoActionmakes its collection unreadable until the metadata row is repaired. See Stored metadata. Database::on(),Database::before(),Mirror::on(),Adapter::before()and theDatabase::EVENT_*constants are removed: registerHook\LifecycleandHook\Transformhooks withDatabase::addHook(). A lifecycle hook receives one typed event object per event (handle(Event\Domain $event)). See Lifecycle events are hooks.- Bulk writes take one
onNext(Document $document, ?Document $previous)callback and no$onError;Database::BATCH_SIZEreplacesINSERT_BATCH_SIZEandDELETE_BATCH_SIZE, and a larger batch size throwsException\Limit.upsertDocumentsWithIncrease()isupsertDocuments(..., increase:).iterate()andforeach()are removed:cursor(), wherelimit()caps the total.find()refuses aggregate andgroupBy()queries: useaggregate(). See Bulk writes and reads. - Every configuration toggle is
set<Noun>(bool)with anis/hasreader:setValidation(),setFiltering(),setLocks(),isPreservingDates(),hasSharedTables(),ignoreDuplicates()and the others replaceenableValidation(),disableValidation(),enableFilters(),disableFilters(),enableLocks(),getPreserveDates(),getSharedTables()andskipDuplicates(). See Configuration toggles. - Instance filters are
Filter\Codecobjects: theDatabaseconstructor takes a list of them instead of an associative array. See Filters. - The 51
Adapter::getSupportFor*()methods are removed: checksupports(Capability::...)orhasFeature(Feature\...::class). The 16 per-limit getters areAdapter::limits(), anAdapter\Limitsvalue, andDatabase::profile()snapshots limits, capabilities and features for the validators. The mandatory adapter contract is the abstract methods ofAdapter;Adapter\Featureholds the optional features only.Adapter\SQLiteextendsAdapter\SQLinstead ofAdapter\MariaDB. See Adapters. Document::getRead(),getCreate(),getUpdate(),getDelete(),getWrite(),find(),findAndReplace()andfindAndRemove()are removed, andgetArrayCopy()takes no arguments: usegetPermissionsByType(),only()andexcept().Exception\OrderandException\OperatorextendException\Query, so acatch (Exception\Query)also catches them. See Errors.- The validators that read adapter limits and capabilities take an
Adapter\Profile. Every validator'sisValid()takesmixed $value, so a named argumentpermissions:,roles:,document:orinput:isvalue:. See Validators and helpers. - Cache key names changed: do not share a cache between 7.x and 8.0 processes, and flush it after the last 7.x process has stopped. See Caches.
Exception\Uniquehas the messageDocument with the requested unique attributes already existson every adapter (wasUnique index violation). On MariaDB and MySQL an unknown column throwsException\NotFound.Database::sum()throwsException\Queryfor an attribute that is not a single number. See Errors.Query::DEFAULT_ALIASistable_main(wasmain),Query::groupByType()returns aUtopia\Database\ParsedQueryobject (withorderAttributesandorderTypes, throwingException\Queryfor a cursor that is not a document), andQuery::TYPE_ELEM_MATCHis removed.new Document()andDocument::setAttribute('$permissions', ...)reject non-string permissions withException\Structure.- Hook failures follow 7.x event by event, with three differences: an
\Erroralways reaches the caller, an isolated failure no longer skips the other hooks, anddocument_purgefromupdateDocument()anddeleteDocument()fires after the write's transaction commits. See Hook failures. createDocuments()underignoreDuplicates()no longer counts skipped documents or passes them toonNext, on every adapter.increaseDocumentAttribute()anddecreaseDocumentAttribute()refuse a fractional change value or a fractionalmax/minon an integer attribute withException\Type, and the numeric operators refuse a fractional limit on an integer attribute withException\Structure, before anything is written. Both accept the same whole-number forms (for example5,'5','5.0'and5.0). See Documents.- Scopes such as
Authorization::skip(),silent(),skipRelationships(),withTenant()and the other scoped toggles apply to the calling coroutine and the coroutines it starts, not to other coroutines sharing the handle. See Coroutines. Mirror::onError()callbacks receive aMirror\Failure. See Mirror.Adapter\Poolextension points renamed:syncBorrowed(),releaseBorrowed(),hostname()and$arguments. See Pool extension points.
- Joins.
Query::join($collection, $alias, $on),leftJoin(),rightJoin()andfullOuterJoin()with a list ofQuery::on()conditions and filters, andcrossJoin($collection, $alias), on the SQL adapters (Capability::Joins), infind(),count(),sum()andgetDocument().- A joined collection is read exactly as a direct
find()on it would be: every row with a collection-level grant, the rows the caller holds document-level read on under document security, andException\Authorizationotherwise. Adding a join never changes which main-collection rows are visible. - A joined read returns what the same joins return over the documents direct reads of each collection return, for every join type and chain of joins: an unreadable document never hides a row an outer join keeps, and a row whose only match is unreadable comes back unmatched.
- Under shared tables every table of a join is limited to the selected tenant before rows are paired, for all join types including PostgreSQL's native full outer join; rows without a tenant are never joined. A later right or full outer join never pairs with another tenant's rows of an earlier table.
- A query may declare at most 8 joins (
Too many joins: at most 8 are allowed), with or without validation (skipValidation()). - Join aliases must be identifiers, unique within the query regardless of case, and different from
Query::DEFAULT_ALIASand from the key of a relationship attribute of the main collection; anything else throwsException\Query. A join alias may use any letter case or be a reserved word. - A join without a select returns the main document plus, under each join alias, the joined collection's
$idand attributes asalias.$idandalias.attribute. The joined collection's internal attributes ($tenant,$permissions,$sequence,$createdAt,$updatedAt) and its relationship attributes that hold a column (the side that stores the related document's id) are returned only when a select names them, or, for the internal attributes other than$tenant, when the select namesalias.*or the read orders by them. Joined values are never returned under a bare attribute name. select('alias.*'), alone or next to other selects, returns the joined row as a direct read of the joined collection returns it: its$id,$sequence,$createdAt,$updatedAt,$permissionsand attributes, but not its$tenant. Joined columns named next to*(select(['*', 'alias.$createdAt'])) are returned with everything*returns. An order may name a joined attribute by its bare name when only one join's collection declares it and the main collection does not; a name several joins declare throwsException\Query.- Joined attributes are returned as a direct read of the joined collection returns them: cast to their types and
passed through every decode filter they declare, so encrypted attributes are decrypted, JSON and arrays decoded
and datetimes formatted. This applies to the implicit projection and to
select('alias.attribute')alike. A decode filter receives a document built from the joined row:$id,$collectionand the joined attributes the query returned ($sequenceand the other internal attributes only when the query returns them). When an outer join matches no row, its attributes are null, whether or not the select namesalias.$id(outsidedistinct()reads, which select only what they name). A cursor taken from a joined result can be passed back withcursorAfter()orcursorBefore(): its joined values are encoded with the joined collection's filters. - A column under a join alias (
alias.column) must be valid on the joined collection for the query type it is used in: an attribute the joined collection declares, or an internal attribute the query type accepts on the main collection (alias.$permissionscan be selected but not filtered or ordered by, andalias.$collectionis never accepted). OtherwiseException\Queryis thrown. This applies tofind(),count(),sum()and to the join conditions and selects ofgetDocument(). - A join condition compares columns its tables hold: in
Query::on($left, $right)the left column belongs to the main collection or to a join declared before it, the right one to the joined collection. An unknown column, a relationship side that holds no column, or a join named before it is declared throwsException\Query. - A join's ON list holds
on()conditions and plain filters (comparisons, ranges, null checks,contains,containsAny,notContains, starts/ends-with, andand()/or()of them); anything else throwsException\Query(Unsupported join ON condition: <method>) infind(),count(),sum()andgetDocument(). - A cursor over a joined read names the joined row: paging a one-to-many, left, right or full outer join returns
every row once in both directions, through rows an outer join did not match and rows without a main document. A
cursor missing an order value is refused by name instead of borrowing the main document's value, and
cursor()over a joined read whose rows lack such a value throws before yielding a row instead of after the first batch.getDocument()with a join pairs the lowest-sequence joined row. See Paging a joined read. - With joins, a bare attribute in an aggregate function or
groupBy()refers to the main collection's attribute when the main collection declares it, else to the attribute of the one joined collection that declares it. A name no collection declares, or that more than one join declares, throwsException\Query; qualify it with the join alias (alias.attribute). search()andnotSearch()on a joined attribute require a fulltext index on that attribute of the joined collection. An encrypted attribute of a joined collection cannot be filtered.- MariaDB, MySQL and SQLite run a full outer join as two queries joined by
UNION ALL. They accept one full outer join per query, and a right join after it has to join on a table joined before the full outer join or on the full outer joined table (directly or through other joins); other chains throwException\Query. PostgreSQL runs full outer joins natively and has no such limit. A full outer join combined with a right join reads, under shared tables, what a dedicated database reads. - On MariaDB, MySQL and SQLite, aggregates,
groupBy(),having(),distinct(), ordering and paging over a full outer join apply once to the whole joined result, exactly as PostgreSQL's native full outer join does. On these engines adistinct()query over a full outer join can only be ordered by selected attributes; any other order throwsException\Query. Full outer joins on these engines are ordered through internal columns that never appear in results, so every attribute and join alias reads back unchanged. updateDocuments()anddeleteDocuments()reject join queries.- A
Validator\Queries\DocumentsorValidator\Queries\Documentyou build yourself accepts joins and aggregations as theAdapter\Profileit is given allows (Capability::Joins,Capability::Aggregations).Validator\Queries\Base::setJoinedCollections()gives a query validator you build yourself the collections its query sets may join. Without it, bare joined attribute names and searches on a join alias are rejected.
- A joined collection is read exactly as a direct
- Aggregations.
Query::count(),countDistinct(),sum(),avg(),min(),max(), the statistical aggregates (stddev(),stddevPop(),stddevSamp(),variance(),varPop(),varSamp()), the bitwise aggregates (bitAnd(),bitOr(),bitXor()),groupBy()andhaving(), throughDatabase::aggregate($collection, $queries)on the SQL adapters (Capability::Aggregations). It returns a list of rows (arrays), names an unaliased aggregate<method>_<attribute>(<method>forcount('*')) and firesdocument_aggregate.- In an aggregation query (one with an aggregate or a
groupBy()), a select may name only the attributes the query groups by. Any other selected attribute throwsException\Query, including$collection,$tenantunless it is grouped, a related document's attribute and a join alias'salias.*.*and relationship wildcards at any depth (key.*,parent.child.*) are accepted and ignored: the rows hold the groups and the aggregates only. A join alias cannot equal a relationship key of the main collection, sokey.*is always the relationship's wildcard. This applies toaggregate(),count()andsum(). having()conditions follow the filter rules: they compare aggregate aliases orgroupByattributes only, aliases at the top level, and the fulltext and value-count rules apply inside them.sum,avg,stddev*,varianceandvar*require a numeric, non-array attribute,bitAnd,bitOrandbitXoran integer one, andminandmaxone whose values are ordered (not an array, object, boolean, spatial or vector attribute), on joined collections too. Onlycountaccepts*. Aggregates andgroupBy()refuse a relationship side that holds no column.Database::sum()resolves a bare attribute name asfind()does: the main collection's attribute, else the one join that declares it.- A joined group sharing its column name with another group of the query is returned under its qualified name
(
groupBy(['name', 'note.name'])returnsnameandnote.name); a joined group alone keeps its bare name. - Over an empty result,
countandcountDistinctreturn0and every other aggregate returnsnull, on every engine. - SQLite has no statistical or bitwise aggregate functions:
aggregate()rejects those aggregates there withException\Query. Aggregate aliases are identifiers of at most 63 characters, and an alias cannot repeat another aggregate's alias or the name a grouped attribute is returned under. - Internal attributes under a join alias (
note.$id,note.$createdAt, ...) can be grouped by.$collectionis never aggregated or grouped by, and$tenant(on the main collection or under an alias) only under shared tables. An aggregate over a main attribute named like its own alias reads the main table when a joined collection declares the same attribute. - A search and a vector query filter an aggregation query; vector distance orders row reads only.
- In an aggregation query (one with an aggregate or a
Query::distinct()on the SQL adapters. A distinct read is ordered, and paged by a cursor, along its explicit orders only; asearch()and a vector query filter it without ordering it, and its rows carry no$distance. On PostgreSQL and MySQL adistinct()query ordered by an unselected attribute throwsException\Query. A distinct row has no$id, so a cursor pages a distinct read by its order values: the read needs aselect()of named attributes and an order on each of them, or it throwsException\Query.- Query builder.
Database::from($collection)returns a utopia-php/query builder over a collection's table,Database::query()runs a built read and returns a list ofDocument,Database::mutate()runs a built write and returns the affected row count, andDatabase::schema()returns a schema builder.from(),query()andmutate()check no permissions, bypass the caches, run no hooks and throwException\Authorizationunless authorization is disabled. Under shared tables every statement afrom()builder runs stays within the tenant selected when it was handed out.from($collection, $alias)names the main table by the alias. A SQL adapter'sbuilder()(Feature\QueryBuilder) is the builderfrom()builds on: itsfrom()and its joins take collection ids, and once it has read a collection it reads that one only, refusingfromTable(),into(), another alias and the multi-table writes (updateJoin(),deleteJoin(),updateFrom(),deleteUsing()), whose second table its tenant scope does not reach. find()query cache.Database::setQueryCache(new Cache\Query($cache))cachesfind()results per hostname, database, namespace, tenant and collection, and writes through theDatabaseinvalidate only the scopes they write in: under shared tables with tenant-per-document, the scope of each written document's tenant. Collection listings are never cached. A cache hit costs 3 cache round trips.- Hooks.
Database::addHook()registersHook\Lifecycle(side effects on events),Hook\Decorator(modifies the documents a read or write returns),Hook\Transform(rewrites SQL before it runs;removeTransform()removes one),Hook\Write(rows of its own for each document write, such asHook\Permissions),Hook\RelationshipsandCache\Invalidator, and throws for any other hook.removeHook()unregisters a hook or every hook of a class. A hook implementingHook\Attachablereceives the database inattach(), sonew Relationships()takes no database. A lifecycle hook that also implementsHook\Namedreplaces the hook registered under the same name, and one that implementsHook\Selectivereceives only the events itshandles()accepts. - Typed events.
Hook\Lifecycle::handle(Event\Domain $event)receives onefinal readonlyevent object per event, underEvent\{Database,Collection,Attribute,Index,Document,Permission}, with a typed payload; bulk writes areEvent\Document\BatchCreated,BatchUpdated,BatchDeletedandBatchUpsertedwith theircount(andcreated/updatedfor upserts). New events:database_update,document_upsert,document_aggregate,attribute_renameandindexes_create. An event object is built only when a registered hook handles its event.Event\DispatcherHookforwards them to listeners per event class and to a PSR-14 dispatcher. - Value objects.
Attribute,IndexandRelationshiparefinal readonly, built by one factory per type (Attribute::string(),Attribute::integer(width: IntegerWidth::Bits64),Index::key(),Index::ttl(),Relationship::oneToMany(), ...), withfromDocument()/toDocument()for storage andapply()/with*()for changed copies.Collection::create()builds a collection, whoseattributes()andindexes()return typed lists.AttributeUpdate,CollectionUpdateandRelationshipUpdatedescribe sparse updates (Unchanged::Valuekeeps a default or format).Formatholds a format name and its options.Attribute::TYPESlists the storable column types andAttribute::availableTypes(Adapter\Profile)narrows it to an adapter.Attribute::storedType()andtypeFromStored()convert betweenColumnTypecases and stored type strings. Afloatattribute type (ColumnType::Float) joinsdouble. - Schema methods.
findCollection(),collectionExists(),createIndexes()(validates every index, writes the definition once),Database::update()(renames a database on every adapter),internalAttributes()andcollectionDefinition(): Collection. The create and update methods return the stored value object.getSchemaAttributes()andgetSchemaIndexes()returnSchema\ColumnandSchema\Indexvalues, and PostgreSQL introspects its schema (Capability::SchemaIntrospection, with MariaDB, MySQL and SQLite). - Enums.
Utopia\Database\Event,PermissionType,RelationshipType,RelationshipSide,RelationshipDeleteAction,SetType,OperatorType,Filter,IntegerWidth,UnchangedandCapability, and from utopia-php/queryMethod,ColumnType,IndexType,OrderDirectionandCursorDirection. - Adapter model.
Adapter::supports(Capability),capabilities()andhasFeature(); the optionalAdapter\FeatureinterfacesCasting,Connection,QueryBuilder,RawQuery,Relationships,Schemaless,Spatial,TimeoutsandUpserts;Adapter::limits()(Adapter\Limits) andDatabase::profile()(Adapter\Profile);Database::setSchemaless();Database::getHostname().Adapter::relaxAttributeRequired()and the protectedAdapter\SQL::getSpatialColumnSrid(): ?int(the SRID written into spatial column definitions, ornullfor a dialect that cannot declare one, such as MariaDB). - Filter codecs.
Filter\Codec(name(),encode(),decode()),Filter\CallbackandFilter\Registry. TheDatabaseconstructor takes a list of codecs, andsetFilters(Filter\Registry)gives a handle a registry several handles can share. A codec applies only to those handles and takes precedence over a global filter of the same name (Database::addFilter()); the constructor's codecs take precedence over both. A codec named after a built-in filter throwsException\Duplicate. Document and query cache keys include each registered codec, by class, or bysignature()for aFilter\Signedcodec such asFilter\Callback. Adapter\ReadWritePool. Sends reads to a read pool and writes to a write pool. Reads stay on the primary for a sticky window after a write or a transaction commits (setStickyDuration(), default 5000 ms;setSticky()), andgetDocument(..., forUpdate: true)andrawQuery()always use the write pool. Metadata and configuration calls never re-open the window, andhostname()always names the write pool's host.- Query profiling.
Database::setProfiling(),isProfiling()andgetProfiler()withUtopia\Database\Profiler, which keeps the newestProfiler::DEFAULT_CAPACITY(1000) entries (setCapacity(),getCapacity());getQueryCount()andgetTotalTime()cover every query since the lastreset(). Pooled connections carry the profiler of the handle that borrowed them only while they are checked out. EachProfiler\Logcarries the statement's bound values, collection and operation (Eventvalue). Utopia\Database\PDO::configure()for session settings that must survive a reconnect.- Documents.
Document::only()andexcept(),fromArray(),getArray(),getDocument(),getDocuments()and theDocument::ID,SEQUENCE,COLLECTION,CREATED_AT,UPDATED_AT,PERMISSIONS,TENANTandDISTANCEkey constants. Utopia\Database\Builder\SQLite, the query builder the SQLite adapter uses (dialectBuilder()returns it). It extendsUtopia\Query\Builder\SQLiteand addsESCAPE '\'to every LIKE predicate.Database::cursor()iterates over a query's matches in batches ofCURSOR_BATCH_SIZE(100) by default (alimit()in the queries caps the iteration, anoffset()orcursorAfter()positions the first batch only),Database::rawQuery()runs a SQL statement as written and returns its rows as documents (likefrom(),query()andmutate()it checks no permissions, applies no tenant scope and runs only insidegetAuthorization()->skip(), otherwiseException\Authorization),Query::containsString()matches a substring of a string attribute, and the Redis adapter supports upserts.Query::exists()andQuery::notExists()run on the SQL adapters. Each value names an attribute of the collection that holds a column, or analias.attributeof a join; other names throwException\Query.Authorization::withRoles()andAdapter::withTenant()scope the roles and the tenant to the calling coroutine, andHook\Relationships::withEnabled()andwithCheckExist()scope the hook's flags the same way.Database::snapshot(),Database::withSnapshot()andHook\Relationships::withSnapshot()are@internal.- Scoped toggles take their value:
withValidation(),withFiltering(),withPreserveDates()andwithPreserveSequence(). Database::setCacheWriterTimeout()bounds how long an unfinished invalidation keeps a collection's document and query cache off.Mirror::awaitReplications(?int $timeout = null)waits until every replication queued through the mirror has reached the destination or has been reported toonError(), for example before a worker stops. A timeout of 0 returns at once; a negative one throws.Mirror\Failuredescribes a failed replication.Exception\Schema, the parent of every schema violation,Exception::$state(a string code such as a SQLSTATE),Exception\Unique::MESSAGE,Exception\Mismatch(aDuplicatefor a shared-table column of another type),Exception\Contention(aTransactionfor a lock conflict with a concurrent transaction),Exception\Unconfirmed(a MongoDB commit whose result could not be confirmed),Exception\Refused(an adapter that returnedfalsefrom a schema change) andValidator\Structure'sstoredAttributesparameter.
- A schema change the adapter returns
falsefor throwsException\Refused. A refusedrenameAttribute(),renameIndex()orupdateRelationship()has one message naming its keys (Failed to rename attribute 'a' to 'b') instead of being wrapped like an adapter error (Failed to rename attribute 'a' to 'b': Failed to rename attribute), and a refusedrenameIndex()no longer tries to complete an earlier rename. These three also let an adapter'sException\DuplicateorException\NotFoundthrough unwrapped, sorenameAttribute()of a column the table lacks throwsException\NotFoundon MariaDB and MySQL as documented.create(),update(),delete(),createCollection()anddeleteCollection()refuse afalsetoo instead of ignoring it, soupdate()anddelete()returntruewhenever they return. See Errors. - A filter on a path into an object attribute takes keys of
a-z,A-Z,0-9,_and-only, on every adapter, and PostgreSQL refuses any other key also when validation is skipped. See Queries. createAttributes()firesattribute_createonce per attribute and thenattributes_createonce with the list (7.x firedattribute_createonce, with an array, and never firedattributes_create).silent($callback, $hooks)silences theHook\Namedhooks with those names. A nestedsilent()never narrows the silence around it, and silences apply to the calling coroutine and the coroutines it starts.Authorization::skip(),Database::skipRelationships(),skipRelationshipsExistCheck(),silent(),withFiltering(),skipFilters(),withValidation(),skipValidation(),withPreserveDates(),withPreserveSequence(),withTenant(),withRequestTimestamp(),ignoreDuplicates()andAuthorization::withRoles()are scoped to the calling coroutine and the coroutines it starts; sibling coroutines sharing the handle or theAuthorizationno longer see them. The plain setters (setStatus(),enable(),disable(),reset(),setTenant(), ...) still change the shared value, except inside a scope over the same state (disable()insideskip(),setTenant()insidewithTenant()), including one the coroutine inherited from the coroutine that started it: there the change applies to the calling coroutine and the coroutines it starts, and lasts until the scope ends. A coroutine sees a scope only while every coroutine between it and the scope's owner is running; work that can outlive its starter opens its own scopes. A coroutine cut off from a scope, because a coroutine between it and the scope's owner has returned, reads the shared values or a scope opened outside every coroutine, and while a scope over the same state is open on the handle its writes stay with it and the coroutines it starts; forAuthorization,skip()andwithRoles()count together. Such a coroutine changes and restores state with those scopes, not with a pair of setters. See Coroutines.- Relationship population reads its chunks of related ids concurrently only on
Adapter\Pool, inside a coroutine and outsidewithTransaction(), and only as many at once asHook\Relationships::READ_CONCURRENCY(4) andPool::getReadConcurrency()(the connections the pool can hand out without waiting, less one) allow; elsewhere it reads them one after another. Related documents are merged in chunk order. - Linking an existing many-to-many related document needs update permission on it, as one-to-one, one-to-many and
many-to-one links already do, on every create and update path and at every nesting depth (7.x needed only read).
Without it the write throws
Exception\Authorization. See Relationships. - Inside a coroutine, a
MirrorreplicatescreateDocuments(),updateDocuments(),upsertDocument(),upsertDocuments(),deleteDocument()anddeleteDocuments()in a coroutine of its own, so the call returns once the source write is done (7.x wrote the destination before returning). Each replication runs under the authorization status and roles, tenant, relationship and silence state and toggles the caller had when it made the call. A mirror applies its changes to the destination one at a time, in the order they were made through it: the calls that reach the destination before returning (createDocument(),updateDocument(),increaseDocumentAttribute(),decreaseDocumentAttribute(), schema changes,create(),delete(),exists(),setTimeout(),clearTimeout()) first wait for the queued replications, and later replications wait for them. The write filters' document hooks run when the replication applies. Outside a coroutine every replication finishes before the call returns. - A
Mirroruses its source'sAuthorizationand leaves the source's and destination's in place; in 7.x it started with one of its own, which it also gave the source's adapter. Mirror::createDocument()returns the document written to the source, asupdateDocument()does, instead of the destination's copy.notContainson an array attribute excludes documents whose array is NULL or missing on every adapter; SQLite and MongoDB used to include them.- On MongoDB,
startsWith()andendsWith()match at the start and at the end of the value. They matched the value anywhere in the string, sostartsWith('foo')returnedbarfoo. Both stay case-sensitive. - On SQLite, document ids compare case-insensitively, as on MariaDB:
getDocument('Doc')findsdoc. - An upsert that creates a document applies every operator to the attribute's default as it does for an existing
document:
dateAddDays()/dateSubDays()shift the date,arrayFilter()filters the array, and the maximum or minimum of increment, decrement, multiply, divide and power is honoured. Database::setTimeout()andclearTimeout()throwAdapter does not support timeoutson SQLite, Memory and Redis; 7.x's SQLite ignored them. See Errors.setSchemaless(true)throws on an adapter without a schemaless mode (every adapter but MongoDB). 7.x'ssetSupportForAttributes(false)returned the requested value on Memory and Redis without applying it.- Schema calls no longer retry deterministic failures of their metadata write (validation, authorization, missing or duplicate documents, limits, conflicts, indexes, dependencies, operators, timeouts, truncation) and no longer sleep before rethrowing them. They no longer run a metadata transaction again after its own retries gave up on a transient failure either: a lock conflict there is attempted 3 times instead of 9.
withTransaction()no longer retries deterministic failures: an invalid document (Structure),NotFound,Query,Type,Index,Dependency,Truncate, any other typed library failure and any other exception (for exampleInvalidArgumentException) run the callback once and are rethrown without sleeping, also in a nested call. Only a failure that can succeed on another attempt is still retried twice with 7.x's backoff: anException\Transaction(includingContention), a lost connection, an engine lock conflict the adapter did not map, or a MongoDB error labelled transient, a network error before the commit or a command that was never sent. Only the outermostwithTransaction()retries it: a nested call rolls back to its savepoint and rethrows, so a lock conflict that keeps failing runs a nested callback 3 times instead of 9. A MongoDB commit whose result is unknown retries only the commit, up to 3 more times with amajoritywrite concern, then fires the queueddocument_purgeevents of the last attempt and throwsException\Unconfirmedwithout running the callback again (7.x ran the callback again); a schema call keeps the table, column or index of a definition whose commit is unconfirmed. A MongoDB commit the server reports aborted, on the first attempt or on a commit retry, runs the callback again: 7.x reported a first commit the server had aborted as a success, losing its writes. On SQL a connection lost duringCOMMITstill runs the callback again, so that work is at-least-once. See Errors.createCollection(),createAttribute(),createAttributes()andcreateIndex()keep the table, column or index, andupdateAttribute(),renameAttribute(),renameIndex(),deleteAttribute()anddeleteIndex()keep their change, when only the cache invalidation after their committed definition failed or its commit is unconfirmed, and do not repeat the write.deleteCollection()anddeleteRelationship()recreate the dropped table or columns empty in that case and throw the failure wrapped.createRelationship()keeps a committed relationship and still creates its indexes in that case; when its indexes fail and the definitions cannot be removed, the columns are kept with them.createCollection()validates attribute types up front, likecreateAttribute(), and throwsUnknown attribute type: <type>. Must be one of <types>for an unknown one.updateAttribute()updatesidattributes and refuses relationship attributes (Cannot update relationship as an attribute).- An empty attribute
format(7.x metadata stores'') reads asnull. Database::VAR_BIGINT('bigint') becomesColumnType::BigInteger, whose value is'biginteger'. Collection metadata still stores'bigint', as in 7.x, so existing metadata needs no migration. Write a stored type withAttribute::storedType()and read one withAttribute::typeFromStored().updateAttribute()withrequired: falserelaxes the column'sNOT NULL; 7.x'supdateAttributeRequired(false)changed only the metadata.AttributeUpdate(default: null)removes the default,format: nullremoves the format, and a default sent withrequired: truethrows. AMirrorreplicates attribute updates.- A 64-bit integer attribute (
IntegerWidth::Bits64, 7.x size 8) gets the bounds[PHP_INT_MIN, PHP_INT_MAX], or[0, PHP_INT_MAX]unsigned, inincreaseDocumentAttribute(),decreaseDocumentAttribute()and the numeric operators; 7.x applied the 32-bit range. - PostgreSQL introspects its schema and reconciles orphan columns and indexes in
createAttribute()andcreateIndex(), as MariaDB, MySQL and SQLite do. - An unaliased aggregate is returned under
<method>_<attribute>, or<method>forcount('*'). cursor()treats alimit()as a cap on the documents it yields.Adapter\Mongo::exists()reports a database only when the server lists it (it returnedtruefor every name), andcollectionExists()looks in the database it is given.Database::delete()still flushes the whole cache it was given, as in 7.x: on a cache shared with other databases (one Redis), give each database handle a cache of its own.- An index of an unknown stored type is read as a key index; creating one is refused.
Connection::hasError()classifies by driver error code (MySQL and MariaDB 1053, 2002, 2006, 2013 and 4031; SQLSTATE class 08; PostgreSQL 57P01 to 57P05) before matching messages, and its message list matches Swoole 6.2.Database::setMetadata()comments precede every statement the SQL adapters prepare, ahead of registeredTransformhooks. Arrays,nulland objects are rendered as JSON. Keys and values are normalised: comment delimiters are split, control characters become spaces and invalid UTF-8 is replaced.purgeCachedQueries()also purges thefind()query cache, and returnsfalsewhen either purge fails.deleteDocument()firesdocument_updatefor each document on the other side of a two-way relationship that the delete changed, as 7.4.0 does. When a hook throws,document_deleteand every relateddocument_updatestill fire, and the first exception reaches the caller afterwards. Finding the peers a cascade left costs a read per related collection, which a delete skips unless an active lifecycle hook handlesdocument_update. Seedocument_updatefor related documents a delete changed.- The locked read of
updateDocument(),increaseDocumentAttribute(),decreaseDocumentAttribute()anddeleteDocument(), and the page reads ofupdateDocuments()anddeleteDocuments(), use the collection definition the write resolved instead of reading it again: a schema change committed after the write resolved its definition, or between two pages, is not seen by that read or those pages, as the write validated and encoded under the earlier one. A bulk write reads_metadataat most once per call instead of once per page. ADatabasesubclass'sgetDocument()andfind()overrides are no longer called for these reads, and itsgetCollection()andfindCollection()overrides are not called bygetDocument(Database::METADATA, ...)while noHook\Decoratoris registered or events are silenced. See Caches. Adapter\Pool::syncBorrowed()replays metadata, the profiler and transforms onto a connection only when the connection's differ from the pool's, as it already did for write hooks; the tenant, schemaless mode, timeouts and the other settings are still synced on every delegated call. APoolsubclass or custom connection adapter can no longer rely onresetMetadata(),setMetadata(),setProfiler(),resetTransforms()oraddTransform()being called on every delegated call. See Pool extension points.
Query::contains(). UsecontainsString()for substring matching on string attributes andcontainsAny()for array attributes. Queries whose method iscontains(for example parsed from JSON) keep working.
Database::on(),Database::before(),Mirror::on()andAdapter::before().- The protected
Adapter\Pool::$pinnedAdapterproperty. A subclass reads the connection the calling coroutine's transaction pinned throughpin(). See Pools and profiling. - The
Database::VAR_*,INDEX_*,ORDER_*,PERMISSION_*,RELATION_*,CURSOR_*andEVENT_*constants, theQuery::TYPE_*constants, theOperator::TYPE_*constants and theDocument::SET_TYPE_*constants, replaced by enums, andDatabase::SPATIAL_TYPES,ATTRIBUTE_FILTER_TYPES,INTERNAL_ATTRIBUTES,INSERT_BATCH_SIZEandDELETE_BATCH_SIZE. See Constants are now enums. Utopia\Database\Helpers\*,Mirroring\Filter,Validator\Attribute,Validator\Index,Validator\Queries,Validator\IndexedQueriesandValidator\ObjectValidator, moved without aliases. See Namespaces.updateAttributeRequired(),updateAttributeFormat(),updateAttributeFormatOptions(),updateAttributeFilters(),updateAttributeDefault()andgetInternalAttributes(). See Schema: value objects.upsertDocumentsWithIncrease(),iterate(),foreach()and the$onErrorparameters. See Bulk writes and reads.enableValidation(),disableValidation(),enableFilters(),disableFilters(),enableLocks(),getPreserveDates(),getPreserveSequence(),getDropUnknownAttributes(),getSharedTables(),getTenantPerDocument(),skipDuplicates(),clearAllDocumentTypes(),getKeywords()andAuthorization::setDefaultStatus(). See Configuration toggles.Document::getRead(),getCreate(),getUpdate(),getDelete(),getWrite(),find(),findAndReplace(),findAndRemove()and thegetArrayCopy()filter parameters. See Documents.- The 51
Adapter::getSupportFor*()methods andgetSupportNonUtfCharacters(). See Capabilities and features. - The 16 per-limit adapter getters (
getLimitFor*(),getMax*(),getCountOfDefault*(),getIdAttributeType(),getDocumentSizeLimit(),getKeywords(),getInternalIndexesKeys()). See Limits and profile. - The base adapter's
ping(),reconnect(),getHostname(),getConnectionId(),setSupportForAttributes(),clearTimeouts(),enableAlterLocks(),setDebug(),getDebug(),resetDebug(),castingBefore(),castingAfter(),setUTCDatetime(),decodePoint(),decodeLinestring()anddecodePolygon(), and the per-adapter methods listed in Methods an adapter no longer has:Mongo::getSchemaAttributes()andgetSchemaIndexes()answer[],Mongo::getConnectionId()isid(), andMemory::upsertDocuments()is gone withFeature\Upserts. SQL::getPDOAttributes()and the protectedSQL::getPDO()(usegetDriver()).Change::getOld(),setOld(),getNew()andsetNew()(use the readonlyoldandnew).- The SQL adapters' string query builders and the hooks behind them (
getSQLConditions(),getSQLCondition(),getSQLPermissionsCondition(),getFulltextValue(),getTenantQuery(),getLikeOperator(),getRegexOperator(),getAttributeProjection(),getRandomOrder(), the insert and upsert statement hooks, and others). See Removed adapter methods. Mongo::getTenantQuery(), which returned an empty string, andSQL::getSpatialTypeFromWKT(). Nothing in the library calls either. See Removed adapter methods.- The protected adapter methods nothing called:
getSQLIndexType()onSQLandSQLite,Postgres::getSQLSchema(),Postgres::encodeArray(),Postgres::decodeArray()andMemory::unregisterRelationshipField(). See Removed adapter methods. Adapter\SQL::setFloatPrecision(),Adapter\SQLite::setEmulateMySQL(),getEmulateMySQL(),Database::getInstanceFilters(),Mirror::getWriteFilters()andValidator\Structure::getFormats(), which nothing calls. See Removed unused public methods.- Renamed protected adapter methods with upper-case acronyms or abbreviations (
getSQLTable(),getSQLType(),getOperatorSQL(),bindOperatorParams(),getIdentifierQuoteChar(), ...) andRedis::tx(). See Writing or subclassing an adapter.
-
deleteRelationship()recreates the relationship's indexes, or its junction collection's definition, when the adapter refuses or fails to drop the relationship, instead of leaving them dropped while the relationship stays. -
On MongoDB,
Adapter\Mongo::createCollection()of an existing collection throwsException\Duplicate, as on the SQL adapters, instead of adopting it without its indexes; under shared tables and for the metadata collection it first creates the collection's indexes, andDatabase::createCollection()adopts the collection. An index conflict (code 85) throwsException\Index. A collection it created but could not give its indexes is dropped, outside a transaction and unless tables are shared, and a refusedcreateCollection()stores no definition. -
Under shared tables,
createCollection()no longer drops the table when storing the definition fails: another tenant may already have adopted it, and the drop removed every tenant's documents. -
createAttributes()drops the columns it created one at a time before a later column failed, instead of leaving them in the schema without a definition. -
updateRelationship()completes an earlier attempt only when every column it renames is already under its new name and no longer under its old one, instead of adopting any column under the new key. -
On PostgreSQL with shared tables,
renameIndex()no longer reports a rename done because another tenant's copy of the index has either name; only the tenant's own index, or the one created with the shared table, counts. -
updateDocument()no longer fails withException\Structure(Unknown attribute) when a schema change commits between its collection definition lookup and its locked read of the document. -
Mirror::clearDocumentTypes()keeps the metadata collection'sCollectiontype, so the mirror'sgetCollection()still returns aCollection(it returned a plainDocument). -
Adapter::hasFeature()no longer tells PHPStan the adapter implements the feature: aPoolanswerstruefor a feature it forwards without implementing it, so code narrowed by the check called methods the pool does not have. A spatial index created through a pooled adapter is no longer refused by aninstanceofcheck. -
sum()andcount()throwException\Queryfor a$maxof 0 or less instead of returning 0. -
A relationship with a stored
onDeleteofsetDefaultornoActionis refused withException\Relationship; it was accepted, and deleting the parent left dangling children. -
A join's ON list holding anything but
on()conditions and filters (limit(),select(), ...) throws when the query is built, and the join keeps its alias (utopia-php/query 0.7). -
Collection::create(documentSecurity: false)storesfalse(it read backtrue), and a collection's other keys are either stored or refused withException\Structure, never dropped. -
A
Mirrorhonours theHook\Relationshipsit is given (for exampleprepare: false) on its source and its destination; it rebuilt the hook with the default settings. -
In
deleteDocuments()'sonNext, the second argument is a separate copy of the stored document, so a callback that changes the first argument no longer changes what it is told the previous state was. -
findOne()fires nothing when no document matches (it fireddocument_findwithfalse), andaggregate()firesdocument_aggregateinstead ofdocument_find. -
addHook()throws for a hook it does not recognise instead of registering nothing. -
increaseDocumentAttribute()anddecreaseDocumentAttribute()throwException\Typefor a change value of 0 or less instead ofInvalidArgumentException. -
MySQL::getSpatialSqlType()is protected, as on the other SQL adapters; MySQL made it public. -
UPGRADE.md, README.md, AGENTS.md and docs/add-new-adapter.md no longer misstate the last 7.x release (7.4.0), the query validator parameters, the adapter contract and the project layout.
-
A well-known-text polygon with holes decodes into its rings on MariaDB, MySQL and PostgreSQL; the rings were merged into one.
-
Deleting a many-to-many relationship on Redis and Memory drops its junction collection, as the SQL and MongoDB adapters do; recreating the relationship hit the leftover junction.
-
The point, linestring and polygon filters no longer swallow an encoder failure and write the value as given.
-
aggregate()throwsException\Queryfor two aggregates that would come back under the same default alias, instead of collapsing their values into one key when validation is off. -
A
Hook\Relationshipsadded to a second database throws instead of rebinding to it, and a query cache shared by several databases uses each caller's cache name and writer timeout instead of the last one it was set on. -
Mirror\FailurenamesDocumentUpsertfor a failedupsertDocument()(it wasnull) andIndexesCreatefor a failedcreateIndexes(). -
With validation skipped, the SQL adapters filter the attribute of
sum()and the grouped columns they qualify with a join alias, and every identifier they quote escapes the quote character. -
A delete retried on the same
Databaseafter its cascade failed (for example on aRestrictedrelated document or a permission failure) now runs the cascade. -
MirrorforwardssetCacheName(),setGlobalCollections(),resetGlobalCollections(),setTenantPerDocument(),setCacheWriterTimeout(),setTimeout(),clearTimeout(),setMetadata(),resetMetadata(),setFiltering(),withFiltering(),skipFilters(),setLocks(),setProfiling(),setMigrating()andsetFilters()to its source and destination. -
Scopes entered on a
Mirrorapply to its source:withTenant(),withPreserveDates()andwithPreserveSequence()to its destination as well,skipRelationships(),skipRelationshipsExistCheck()andwithRequestTimestamp()to the source only.withRequestTimestamp()runs its callback once. -
Mirror::setLocks()reports a destination that cannot apply the setting throughonError()(methodsetLocks) instead of throwing after the source applied it, andMirror::create()throws when the destination cannot create the database. -
A
Mirrorwrite filter whosebeforeCreateCollection(),beforeUpdateCollection(),beforeUpdateAttribute()orbeforeCreateIndex()returnsnullskips that change on the destination, asMirror\Filterdocuments; the mirror returns the source's result, and a collection whose creation was skipped is not replicated. -
Mirror::createDocument()andupdateDocument()restore the destination's preserve-dates setting after replicating, also when the destination write fails. -
Mirror::upsertDocument()and an increasingMirror::upsertDocuments()run on the source and replicate to the destination. -
createCollection(),createAttribute()andcreateAttributes()no longer modify theAttributeandIndexobjects passed to them. -
resetMetadata()removes the query comments at once; the previous metadata no longer annotates later statements. -
Without Swoole's library, MySQL 8.0.24+'s idle disconnect (error 4031) is recognised as a lost connection and reconnected, instead of failing the first query after every idle period.
-
Linking a related document at any nesting depth of an update needs update permission on that document, and throws
Exception\Authorizationwithout writing anything when the caller lacks it. -
deleteDocuments()with a select no longer skips a one-to-one or one-to-manyCascadeor ignoresRestricton one-to-one, one-to-many and many-to-many relationships. Cascade and restrict targets are read from storage with permissions skipped, asSetNullalready did, so related documents the caller cannot read are cascaded (subject to the caller's delete permission on each) or block aRestrictdelete. -
A nested one-to-one write that throws no longer leaves an entry on the relationship write stack. Before, every later write on the same
Databasetreated its nested relationships as one level deeper and dropped the deepest ones without an error. -
Coroutines sharing a
Databasekeep their own relationship write and cascade stacks (also in 7.x). Before, a coroutine in the middle of a nested relationship write made another coroutine's nested writes look deeper, so their deepest related documents were dropped without an error, and a coroutine in the middle of a cascading delete could stop another coroutine's cascade, leaving its related documents behind. -
Adapter\Poolpins a transaction's connection for the coroutine that opened the transaction and the coroutines it starts (also in 7.x). Before, every coroutine sharing the handle ran its statements on that connection while the transaction was open, so they were committed or rolled back with it and their ownwithTransaction()became a savepoint in it. Each call on the pinned connection also runs under its own coroutine's tenant; before, two coroutines with differentwithTenant()scopes overwrote each other's tenant on it. -
A filter on a nested relationship path (for example
Query::equal('children.tags.name', [...])) no longer throwsException\Querywhen a step of the path matches more documents thangetMaxQueryValues(): each step reads its matches in chunks within the limit. A path that passes through the parent side of a one-to-many or the child side of a many-to-one no longer throwsCannot select attributes. -
Linking a document by value in a two-way one-to-one update stores the back-reference on the related document, and writes its nested documents as deep as
createDocument()does. -
A new related document created through a many-to-many update keeps the
$permissionsit was given. Before, they were always replaced by the parent's. A related document created without$permissionsstill takes the parent's. -
A nested
withTransaction()whose enclosing transaction was lost (for example, the server ended the session) throwsException\Transaction, and so does the outer call. Before, the nested call began a fresh top-level transaction and committed its own writes alone while the outer call returned normally. A top-levelwithTransaction()whose commit finds the connection no longer holds the transaction throwsException\Transactioninstead of returning as if its work were stored;commitTransaction()no longer returnsfalsefor it. -
A nested
withTransaction()whose statement lost a deadlock on MariaDB or MySQL rethrows the deadlock (Exception\Contention), and the outermost call runs again as in 7.x. The engine rolls the whole transaction back, so nothing of that attempt is stored. The 8.0 pre-releases reported such a transaction as lost and did not run it again. -
Utopia\Database\PDOrefuses statements after a reconnect lost the open transaction, until the transaction is rolled back, so a swallowed connection error can no longer make later statements autocommit.Utopia\Database\PDO::reconnect()replays attributes set withsetAttribute()after connecting. -
Increasing or decreasing an optional numeric attribute that was never set stores the result (the unset value counts as zero), on every adapter; before, the SQL adapters left the column NULL and MongoDB rejected the update. A
max/minbound also treats the unset value as zero. -
On MariaDB and MySQL,
updateDocument()stores a case-only rename (abc→ABC) even when it is looked up by the new casing, and moves the document's permission rows with it. -
find()no longer changes the cursor document passed toQuery::cursorAfter()/cursorBefore(). -
updateDocuments()insidewithRequestTimestamp()compares each stored document's$updatedAtwith the request timestamp, instead of always throwingException\Conflict. -
updateDocuments()handsonNextevery attribute it wrote decoded, once, including under aselectthat leaves the attribute out and after a retried transaction; nothing theselectleft out is added. -
In a two-way one-to-one relationship,
updateDocument()rejects a document already linked to another document withException\Duplicate(Document already has a related document) before writing anything, and no longer rejects a free document whose id matches a linked document of the other collection. -
createDocuments()underignoreDuplicates()writes permissions only for the documents it inserted. A replayed id no longer adds its permissions to the stored document (MariaDB, MySQL and SQLite; also present in 7.x), and a row skipped for another unique value leaves no permission rows behind. On MongoDB it matches ids as its_uidindex does (ignoring case and accents), instead of failing on an id stored with different case, and it reports only the documents its upserts inserted: it reads back the$sequenceeach was given, so an id the index matches or one another writer stores first is not counted. A document it inserts without a$sequencegets a UUID v7 one, ascreateDocuments()withoutignoreDuplicates()gives it, instead of a server-generatedObjectId. -
Adapter::find()with no limit and an offset returns the rows after the offset on every SQL engine instead of throwing (MariaDB, MySQL and SQLite rejectedOFFSETwithoutLIMIT; also in 7.x). -
A failed rollback of a metadata write no longer replaces or mislabels the error that failed the write.
-
A failed
createCollection()whose rollback also fails throws the metadata failure (message and previous exception) instead of the rollback's error; the rollback failure is logged. -
createAttributes()rolls back every column it created when a driver error (for example a lock timeout or a lost connection on PostgreSQL) interrupts dropping one of them, and throws the metadata failure with that error appended, instead of letting the driver error escape and leaving the remaining columns. A PHPError(for example aTypeError) raised while dropping a column is rethrown unchanged instead of being collected. -
renameIndex()fails withFailed to rename index '<old>' to '<new>'and keeps the old key in the metadata when the schema has the index under neither name, instead of recording a rename that did not happen. This holds on PostgreSQL, MariaDB, MySQL, MongoDB, Memory and Redis; PostgreSQL, Memory and Redis used to report such a rename as done. SQLite rebuilds the index under the new name from its definition, so its schema matches the metadata. An index the schema already has under the new name completes the rename on every adapter but MongoDB, which drops the old index first and fails with the driver's IndexNotFound, as before. Under shared tables a tenant's rename also completes while the collection's shared index has either name (on PostgreSQL, while another tenant's copy of it does); MongoDB's shared tables are unchanged. -
A failed
updateRelationship()restores the definitions it had already written (parent, two-way child, junction keys) and rethrows the original error. Its rollback reverses the column rename before renaming the indexes back, so SQLite, Memory and MongoDB rebuild each index over the column it covers instead of losing it. -
Type mismatch messages spell bigint
bigint, as stored. Spatial attribute defaults are validated. -
A stored value that newer validation rules reject no longer blocks
updateDocument()of other attributes, and a storedjsonvalue with a non-string permission no longer makesgetDocument(),find()orupdateDocument()throw, including through mapped document types and the caches. -
createAttribute()andcreateAttributes()refuse a varchar of size 0 or above the maximum varchar length, ascreateCollection()does and as 7.x did. -
A failed
createCollection()(a declared index that fails, a timeout, a spatial index with orders, a permissions table that fails) drops the tables it created, so the collection can be created again. It used to leave them, and later creates failed withCollection already exists. When that drop fails as well (for example inside an aborted PostgreSQL transaction or after a lost connection), the drop failure is logged and the error that failed the create is thrown. -
createIndex()compares an index that exists in the schema but not in the metadata with the request (columns, prefix lengths, key, unique, fulltext or spatial) on adapters with schema index introspection: a match is adopted, a mismatch is dropped and recreated, as in 7.3.12. -
createIndex()andcreateIndexes()refuse a unique index over documents that already share a value withException\Uniqueand keep no metadata for it, as 7.4.1 does. The adapter's error was taken for an index already in the schema, so the index was recorded without being built; SQLite threw a rawPDOExceptioninstead. -
An index key longer than the engine allows throws
Exception\Index(Index key length exceeds the maximum) on MariaDB and MySQL, and an index row too large throwsException\Limit(Index row size exceeds the maximum) on PostgreSQL, as 7.4.1 does. Both threw a rawPDOException. -
A document stored before an attribute became required, and so holding null for it, can be updated and upserted without a value for that attribute, as 7.4.1 does; every write failed with
Missing required attribute. Creating a document without it, or clearing a stored value, still fails. -
PostgreSQL:
distanceLessThan()uses the spatial index;ST_Distance()alone cannot, so a radius query filtered every row. It leads withST_DWithin()on the geometry, or, for a distance in meters from a point to a point attribute, with a degree box that holds every point in range. Lines, polygons and boxes that would reach a pole or the antimeridian keep the exact comparison only, which stays in every case, so the boundary is still exclusive. 7.x carries the same fix after 7.4.1. -
The SQL adapters load on a PHP without ext-swoole, which composer.json only suggests: no native parameter, return or property type names a Swoole class, so PHP no longer fails to check
SQL::getDriver()and the statement methods against their parents (Could not check compatibility ... class Swoole\Database\PDOProxy is not available). The Swoole proxies stay in their docblock types. -
A distance query whose distance is not finite (
NAN,INF,-INF) is rejected withDistance query requires a finite distance. PostgreSQL compares'NaN'as above every number, so its index condition and its exact check disagreed on such a distance. -
updateAttribute()no longer fails on MongoDB, Memory and Redis when a key or unique index covers the attribute (the index was compared with itself). -
Validator\IndexDefinitionrejects an index definition without a type, with an unknown type, or a TTL index withoutttl, as 7.x did;Index::fromDocument()reads an unknown stored type askeyinstead of throwing.Validator\IndexDefinitioncounts big integer columns (big integer, id, 64-bit integer) as 8 bytes toward the maximum index length, and judges an index on a text attribute declared without a size against the engine's text maximum instead of 0. -
analyzeCollection()refreshes planner statistics on PostgreSQL and SQLite (the collection's table and its permissions table) and returnstrue; it returnedfalsethere. Call it after bulk loads. -
Engine errors map to library exceptions: lock conflicts (MariaDB/MySQL 1213, 1205; PostgreSQL 40P01, 40001, 55P03; SQLite
database is locked) toException\Contention, a subclass ofException\Transaction; MariaDB/MySQL 1146 and 1072, SQLiteno such column, PostgreSQL 22021, 42883 and 42P01 naming an alias toNotFound,CharacterandQuery; PostgreSQL's distinct() order error in any server language. PostgreSQLdeleteCollection()of a collection whose table is gone succeeds again, and MariaDB/MySQL drop its permissions table too, so the collection can be created again. See Errors. -
PostgreSQL:
updateAttribute()on a datetime attribute (a rename throughnewKey, or any change that rewrites the column) no longer fails with an undefinedto_timestamp(timestamp)function, which left the column renamed and the metadata unchanged.createCollection()with an index on an object path (data.country) creates the index on the JSON path instead of failing withAttribute not found. -
MariaDB: spatial columns are declared without an SRID on every path (
POINT,LINESTRING,POLYGON);createCollection()andupdateAttribute()wrotePOINT(4326), which declared no SRID on MariaDB either. -
Shared tables:
createAttribute()andcreateAttributes()no longer drop a column another tenant's collection uses when the requested type differs. The attribute is refused withException\Duplicate(Attribute exists in the shared table with another type;Exception\Mismatchon PostgreSQL); a column of the same type is reused, including on MariaDB where the engine spellsINTasint(11)and JSON aslongtext. A failedcreateAttributes()metadata write rolls back only the columns that call created.createIndex()over an index another tenant uses with another definition throwsDuplicate(Index exists in the shared table with another definition). -
Shared tables: renaming an attribute tenant by tenant (
renameAttribute(), orupdateAttribute()with a new key) completes for every tenant of a collection id on PostgreSQL, MariaDB, MySQL and SQLite. The first tenant renames the shared column; each later tenant finds it renamed and only updates its own metadata (and, forupdateAttribute(), applies its type to the renamed column). A rename left half done by a failed metadata write also completes when retried on PostgreSQL. On PostgreSQL,renameIndex()completes for a tenant whose collection uses an index another tenant created. -
Renaming an attribute onto a column that still sits beside the old one (under shared tables, another tenant's attribute) throws
Duplicate(Attribute already exists) on every SQL engine and leaves the metadata and values unchanged. MariaDB, MySQL and SQLite used to adopt that column and strand the attribute's values in the old one; PostgreSQL threw a generic exception. -
A filter on a joined attribute (
alias.attribute), in the query or in a join's ON list, and ahaving()condition are converted as a filter on the main collection is:contains,containsAny,containsAllandnotContainson a joined array match elements rather than substrings (containsAny('th.tags', ['a'])no longer matches['banana']), and joined datetimes,alias.$createdAtandalias.$updatedAtincluded, are compared in UTC whatever offset the value carries, infind(),count(),sum()andgetDocument(). Ahaving()condition on aminormaxalias is compared as the aggregated attribute. -
A select that names a joined attribute (
select(['name', 'alias.name'])) returns only what it names: the main collection's unselected attributes are no longer returned (arrays as[]) next to it. -
SQLite:
contains,containsAny,containsAllandnotContainson array attributes compare elements by value (strings, integers, doubles, booleans); they previously matched no element. The query builder'sjsonContains,jsonNotContainsandjsonOverlapsfilters on SQLite are fixed the same way. -
SQLite: document id lookups, permission checks and joins on
$iduse the unique_uidindex again; they previously scanned the table, and shared-table self-joins could run for hours.Query::regex()works again through the adapter'sREGEXPfunction. -
SQLite:
search()/notSearch()on a joined attribute (Query::search('alias.attribute', ...)) use the joined collection's fulltext index, so a multi-word term matches as it does on the main collection; a search on an attribute without a fulltext index (validation off) matches a backslash in the term literally;getSchemaIndexes()lists every index under its index id, as MariaDB and MySQL do, and under shared tables lists the indexes on the shared table once each;deleteIndex()on one of several fulltext indexes no longer throwsCannot resolve fulltext index. -
SQLite:
arrayRemove()removes integers and floats, in upserts as well as updates, and an upsert that creates a document refuses an operator result outside the 64-bit integer range withException\Limit(Value out of range), as MariaDB, MySQL and PostgreSQL do. A full outer join ordered withQuery::orderRandom()no longer fails on SQLite. -
MongoDB:
count()throws the driver's error (mapped as forfind()) instead of returning0when the query fails for a reason other than a timeout, for example an invalid regular expression. -
MongoDB: unique indexes that
createIndex()creates on integer, big integer, float, boolean and datetime attributes reject duplicates; their partial filter required a string value, so they covered no document. Unique indexes created bycreateCollection()also cover integers past 32 bits, big integers inside 32 bits and floats stored as integers. A unique index on an attribute without a declared type (an internal attribute such as$createdAt, or any attribute of a schemaless collection) covers a value of every BSON type the driver writes but null, arrays, binary data and timestamps included; it required a string, and 7.4.1 covers strings, numbers, booleans, dates and objects only. Key indexes are used by queries: their partial filter now requires only that the index's first attribute exists. Existing indexes keep their old filter until they are rebuilt: see MongoDB: rebuild key and unique indexes. -
MongoDB:
containsAll()works onfind()(it matched nothing there, whilecount()andsum()worked); renaming or deleting an attribute whose key contains a dot acts on its stored values;sum()filters on and sums attributes whose key contains a dot; a storednulltenant reads back as$tenant.contains,notContains,notSearch,notStartsWithandnotEndsWithmatch values containing$followed by letters (such as$USD) instead of throwing. -
On an adapter without
Capability::OrderRandom(MongoDB),orderRandom()fails validation withException\Query(Random order is not supported by this adapter). MongoDB threw a genericExceptionfrom the adapter. -
find()refusesQuery::distinct()on adapters without aggregation support (Memory, Redis, MongoDB) withException\Query, also when validation is skipped; MongoDB returned duplicate rows. -
Operator::power()accepts a numeric text exponent ('2') on every adapter again, as in 7.x; non-numeric text is still refused. A whole-number float limit on an operator (for exampleOperator::increment(1, 9.0e18)on a big integer) is compared exactly on the SQL adapters, and honoured exactly on Memory and Redis when the result leaves the native integer range; whole-number limits beyond PHP's int range on unsigned big integers and'100.0'-style strings are accepted. -
Memory adapter: deleting a document by an id in another casing removes its permissions; under shared tables, deleting or revoking a document no longer leaves another tenant's same-id document with stale permissions; renaming a document that keeps a value in a unique index no longer throws a unique conflict;
listCollections()includes collections created without a tenant, as the SQL adapters do. -
Redis adapter:
updateDocuments()and upsert updates enforce unique indexes, including collisions within the batch; under tenant-per-document, unique indexes are checked within the document's own tenant; dropping a collection deletes only its own keys, andgetSizeOfCollection()andgetSizeOfCollectionOnDisk()count only them (a collection whose id matched a key segment, such asdoc, reached other collections' permission data). -
Under shared tables with tenant-per-document,
upsertDocuments()hands each document toonNextwith its own tenant's$sequencewhen one batch creates the same id under several tenants (SQL adapters). -
The MongoDB adapter returns server-generated
ObjectIdsequences of batch writes as strings instead of'', and resolves the sequences of documents without a tenant under the adapter's tenant. -
The Redis adapter files each document's permission entries under the document's own tenant.
These fix builds of the feat-query-lib branch that preceded 8.0.0. Most of them restore 7.x behaviour, so they do
not change anything for an upgrade from 7.x.
- Aggregations, distinct and search:
- An aggregation query (an aggregate or a
groupBy()) next to a fulltextsearch()or a vector query, with no explicit order, no longer fails in the engine (MariaDB and MySQL 1064 or 1055, PostgreSQL 42803). On MariaDB it no longer returns an extra_relevancecolumn. The search and the vector query filter an aggregation query; vector distance orders row reads only. - A
distinct()read next to a fulltextsearch()returns each distinct selection once. Before, it returned one row per relevance value, each with a_relevancecolumn (MariaDB, MySQL, PostgreSQL). Next to a vector query it no longer fails on PostgreSQL (42P10, reported asA distinct() query can only be ordered by a selected attribute on this database). Vector distance orders row reads only. A distinct read is ordered, and paged by a cursor, along its explicit orders; the search and the vector query only filter it. - A fulltext
search()read paged with a cursor lists every match exactly once. A search only filters, as in 7.x: the read is ordered by its explicit orders and then by$sequence, and a cursor pages along them. Search results are not ranked by relevance and carry no_relevanceattribute. - Aggregates and
distinct()no longer surface raw engine errors: an ungrouped select or order next to an aggregate, an unsupported aggregate on SQLite, an alias PostgreSQL would truncate, or a main attribute aggregated under its own name over a join is rejected or resolved before the statement runs. MariaDB and MySQL map errors 1116 and 1191, and MySQL 3065 and PostgreSQL 42P10 (adistinct()query ordered by an unselected attribute), toException\Query. - A vector search ordered by a joined attribute pages with a cursor on PostgreSQL.
- On SQLite,
count()andsum()next to a fulltextsearch()apply the search instead of throwing. - A fulltext
search()ornotSearch()term splits into words at every character other than a letter, a number, an underscore or whitespace, as in 7.x. On PostgreSQLsearch('title', 'foo/bar')matched nothing andsearch('title', 'foo,bar')(or;,?,#,%,=,:) matched onlyfoodirectly followed bybar; both again match either word. MariaDB and MySQL bind the same term as 7.x. - A
distinct()read whose select names only joined columns returns each of them once, under its alias, and accepts a joined internal attribute (alias.$id). - A filter on a joined column is checked against the joined collection's attribute as a filter on the main
collection is checked against its own: a value of the wrong type, a comparison an array attribute does not take,
or
containson a number is rejected asException\Queryinstead of failing in the engine (PostgreSQL 22P02, 22007, 42883) or asUnknown PDO Type. Vector queries cannot target a joined attribute. Validator\Queries\Basewith alengthcaps every nested query group again, as in 7.x.count()andsum()with filters or document permissions run one flat aggregate over the table, as 7.x did, instead of an aggregate over a derived table; only$maxand joins keep the derived table.count()andsum()throwException\Queryfor a statement the query builder refuses, and the mapped engine exception (NotFoundfor a missing table on SQLite) for an error while preparing, asfind()does, instead of rawUtopia\QueryandPDOexceptions.- An unaliased
bitAnd(),bitOr()orbitXor()over an empty result returnsnullon MariaDB and MySQL, as an aliased one does.
- An aggregation query (an aggregate or a
- Query cache:
- The
find()query cache no longer switches off or discards other tenants' (namespaces', databases') cached results when one of them writes. listCollections()no longer returns a stale listing when a query cache is installed.Mirror::setQueryCache()installs the query cache on the source and destination, so writes through a mirror invalidate it, and anInvalidatoradded through a mirror is installed on the mirror too.- Under shared tables with tenant-per-document, a write refreshes the cached
find()results of each written document's tenant, whichever tenant is selected on the writingDatabase, and leaves every other tenant's in place. - A written document's own attribute named
optionsno longer names a collection to invalidate. - A write to one document no longer retires every cached document of its collection, and single-document writes
no longer block the collection's cache while they run.
updateDocument()invalidates the cache once instead of twice. - Reads and writes no longer leave a key behind in Redis each: a document has one key, with a field per selection,
as in 7.x, and a collection's
find()results live in one hash of at mostCache\Query'sslotsfields (1024 by default), which an invalidation retires by epoch without deleting them, so a write costs the same whatever the collection has cached. On the Redis adapters a collection's batch and schema invalidations register as fields of one#ownerskey; adapters that store no fields keep a key per invalidation, which their purge deletes. On Redis, keys matching*#owner:*, document entries whose key ends in:<hash>#<epoch>and query-cache keys matching*:qcache:*#active:*left by earlier builds are no longer read and can be deleted. - Cache lookups cost one round trip again: a cached
getDocument()is two round trips (was 12) andgetCollection(),find(),count()andsum()one (was 6) before their query; single-document writes take 3 each, at or below 7.x's (create 3, update and delete 6, increase and decrease 4). - A cached miss for one casing of a document id no longer hides another casing on engines that compare ids case-sensitively (PostgreSQL, MongoDB).
- Reads inside
withTransaction()are served from the document cache again, except for documents the transaction wrote and collections whose cache it retired: a write no longer reads its collection definition from the database inside its own transaction. Reads inside a transaction still never write to the cache. A missing collection costs one read of_metadataagain, as in 7.x. - Inside
withTransaction(), a collection definition read underskipFilters()and a filtered read of it no longer share one copy: a raw_metadataread no longer makes later writes in the transaction fail, and askipFilters()read after a filtered one returns the raw definition. - With
ReadWritePool, a document or query result served by a read replica is no longer cached, so a lagging replica cannot leave an old version in the cache for other handles. - A writer killed between blocking and re-enabling a collection's document or query cache no longer keeps that
cache off until a flush (see
setCacheWriterTimeout()). purgeCachedCollection()also drops the collection's cachedfind()results,purgeCachedQueries()returnsfalsewhen the cache fails, as documented, instead of throwing, and a query-cache backend error no longer makesfind()throw: it reads the database and logs a warning.
- The
- Permissions and tenancy:
- Under shared tables,
upsertDocuments()andupsertDocument()store their permission rows under the tenant, on an adapter with no earlier write and throughAdapter\Poolalike. - On the SQL adapters, under shared tables with tenant-per-document,
upsertDocuments()and an increasingupsertDocuments()remove a revoked permission under the upserted document's own tenant. listCollections()andfind(Database::METADATA)return only the definitions the caller may read, as in 7.x, and agree withcount(Database::METADATA). Definitions created without a tenant are listed from every tenant of a shared pool.- The MongoDB adapter filters
find(),count()andsum()by document permissions while authorization is enabled, whether or notHook\Permissionsis registered, and scopes writes andgetDocument()by tenant only, as in 7.x. Writes authorized through update or delete permission succeed without read permission. - Under shared tables, the MongoDB adapter upserts each document under its own tenant, falling back to the selected one, as in 7.x.
- A cascade below the first level deletes each related document through
deleteDocument(), as in 7.x: a related document the caller may not read is deleted with the rest, blocks the delete underRestrict, and rolls the delete back when the caller may not delete it.updateDocument()compares a relationship's stored keys at every depth before linking. getDocument()records a missing document in the document cache only after an unfiltered read confirms it.- Document permissions follow every write to
$permissions(ArrayAccess, references,exchangeArray(),unset), andgetPermissions()returns a de-duplicated list again. - Relationship population that needed more than one query (more related ids than
getMaxQueryValues()) could leave the handle with authorization and relationships disabled, populate related documents the caller may not read, and deliverdocument_findevents insidesilent(). - Permission-checked reads (
find(),count(), and the raw builder's outer joins under shared tables) work again when the database or namespace name starts with a digit or a hyphen; such names are quoted. A permissions table or join alias that is unsafe even when quoted (a space,;, a quote character, an empty name) is refused withUtopia\Database\Exception. - Scoped toggles (
skipFilters(),skipValidation(),withPreserveDates(),withPreserveSequence(),withTenant(),withRequestTimestamp(),ignoreDuplicates()) no longer reach other coroutines sharing a handle, and overlapping scopes in different coroutines no longer leave the handle on another scope's value. - A setter called in a coroutine started inside a scope (
addRole(),removeRole()orcleanRoles()insidewithRoles(),disable()orreset()insideskip(),setTenant()insidewithTenant(), and the setters of the other scoped toggles) changes only what that coroutine and the coroutines it starts see, until the scope ends. Before, it changed the shared value: the coroutine that called it did not see the change, every other coroutine sharing the handle did, and the change outlived the scope, so adisable()insideskip()left authorization off and anaddRole()insidewithRoles()gave every caller the scope's roles.
- Under shared tables,
- Hooks and events:
- Every document write fires
document_purgeagain, once per purged document. silent($callback, $listeners)no longer silences every hook.document_purgefor writes insidewithTransaction()fires after the outer transaction commits instead of inside it, and not at all when it rolls back or for a retried attempt. It fires for a committed write even when the cache invalidation after the commit fails.- A failed nested
withTransaction()on an adapter without savepoints (MongoDB) no longer drops thedocument_purgeevents of writes that commit with the caller. deleteCollection()anddelete()purge their caches beforecollection_deleteanddatabase_deleterun, andupdateRelationship()firesattribute_updateafter both sides are renamed, so a hook that throws an\Errorleaves no stale cache entry and no metadata that disagrees with the columns.
- Every document write fires
- Documents and schema:
- A document id of
'unique()'is stored verbatim again, as in 7.x, including for related documents created through relationship attributes. Only an empty id asks the library to generate one. - A create that writes its new related documents in one pass files a related document given as an associative
array under its relationship's collection (MongoDB threw
Duplicate), leaves a lock conflict to the outermostwithTransaction()to retry, as in 7.x, and no longer applies attribute filters twice when it falls back to writing the related documents one by one. updateDocuments()with anOperatordecodes the refetched batch once;count()andsum()on a missing collection throwException\NotFound; a case-only$idrename inupdateDocument()is applied; and every internal metadata write runs Structure validation, as in 7.x.deleteCollection(Database::METADATA)succeeds again, as in 7.x: it purges every cached definition before it drops the metadata table.- Unstorable attribute types (
timestamp,serial,smallserial,bigserialand the other types no adapter can store) are rejected when an attribute is created, including whencreateAttribute()adopts an existing column; increments and numeric operators accept integer, bigint, float and double attributes only. - A failed column change in
updateAttribute()leaves the stored definition unchanged: relaxingrequiredruns before the metadata write. - Reads on MongoDB, Memory and Redis return a stored document that has a non-string permission with that entry
dropped, as the SQL adapters do, instead of throwing
Exception\Structure. - The Redis adapter throws
Exception\Unique, not a plainDuplicate, for unique index violations. - Filter codecs stay on the handles that share their
Filter\Registryinstead of replacing global filters. - A write no longer throws
Failed to finish document cache invalidationafter it commits when the cache is flushed while the write invalidates its collection's cached documents, for example bydelete()of another database that shares the cache.
- A document id of
- SQL adapters:
- A transparent reconnect of
Utopia\Database\PDOkeeps MariaDB and MySQL statement timeouts; the timeout also applies to the statement retried after the reconnect. setMetadata()values reach the database as query comments again.- On SQLite, pattern queries match
_,%and\literally again, and index names use the filtered tenant again. ignoreDuplicates()on PostgreSQL skips only a stored id again and throwsUniquefor a collision on another unique index, as in 7.x.- Batch
createAttributes()works for spatial attributes on MariaDB, required spatial attributes on PostgreSQL are nullable columns again, and composite indexes keep the caller's column order. - On MySQL, a read with five or more joins no longer spends seconds choosing a join order: the joined collections' document permission checks stay subqueries instead of each joining the optimizer's search, which built about ten million partial plans for eight checked joins. Reads with up to four joins are planned as before. Outer joins to document-security collections no longer run their permission check as a semi-join either (seconds per read, or timeouts, with one to four joins).
- PostgreSQL writes a transaction's statement timeout once, with
SET LOCAL statement_timeout, and changes it only when a statement needs a different one, instead of wrapping every statement of the transaction inSET LOCALandSET LOCAL statement_timeout = DEFAULT. A timeout scoped to one event still does not reach the other statements of the transaction. Outside a transaction the session-levelSET/RESETpair is unchanged. - MariaDB and MySQL no longer read the driver to clear a timeout that was never set, so a pooled checkout without a timeout issues no statement and does not require a PDO.
- SQL adapters no longer keep a per-collection spatial column list for the life of the process.
- A transparent reconnect of
- Pools:
- A borrowed connection keeps its cached limits unless the shared-tables mode changes, and
Database::getMinDateTime()andgetMaxDateTime()return copies, so a caller can no longer move the limit for every validator. - Writing a spatial value through
Poolno longer checks a connection out to encode it. ReadWritePoolserves reads from the primary after a write or transaction commits, routes locking reads,rawQuery()and the reads that decide a write (the batch ofupdateDocuments()anddeleteDocuments(), the lookup ofupsertDocuments()) to the write pool, and no longer keeps reads on the primary after metadata or configuration calls.- Pooled connections no longer keep the profiler of the handle that last borrowed them.
Adapter\PoolpassesDatabase::setLocks()on to every borrowed connection, and answers capability questions without checking a connection out after the first (a cached read no longer needs eight connections).
- A borrowed connection keeps its cached limits unless the shared-tables mode changes, and
- Mirror:
- A replicated
upsertDocument()keeps the source's dates on the destination. - A replication no longer changes the caller's authorization status. It runs under the status, roles, tenant,
relationship and silence state the caller had when it made the call, also after the caller left a
skip(),skipRelationships()orsilent()scope, so a write made insideskip()no longer fails on the destination. - Changes reach the destination one at a time, in the order they were made through the mirror; a failed
replication is reported to
onError()and does not hold back later ones. A write to a document created through a relationship, a write made before returning, and a relationship or collection change after queued writes to the related collection no longer overtake earlier replications, and replications no longer share the destination's connection, preserve-dates or skip-duplicates settings. - Outside a coroutine, replications finish before the call returns; before, a destination write that yielded
never resumed. Synchronous replications inside
withTenant()use the caller's tenant on the destination. - An exception from a write filter's
before*document hook is reported toonError()under the write's method and skips that replication, as in 7.x, instead of reaching the caller after the source write. - Decorators added through a mirror apply to the documents its writes return and hand
onNext, not only to reads; the destination receives undecorated documents.
- A replicated
- Performance:
- Permission checks no longer use
SELECT DISTINCTin their subquery (SQLite built a temporary B-tree per read). - A delete whose set-null relationship clears related documents keeps them only when
deleteDocument()reports them, for a two-way relationship while an active lifecycle hook handlesdocument_update, instead of holding every cleared document until the delete returns. - The query and document caches list a collection's owner registrations (
HKEYS) only until the cache shows it keeps hash fields, instead of twice per invalidation. - SQLite:
createDocument()reads the new sequence fromPDO::lastInsertId()instead of aSELECT last_insert_rowid()statement: one statement fewer per document, as in 7.x. - MongoDB:
find()reads the internal attribute definitions once per process instead of once per returned row, and skips list keys when it restores stored field names. - MongoDB:
find(),createDocuments(),updateDocuments()andupsertDocuments()cast a page or batch of documents in onecastAfter()call, one pool checkout instead of one per document. - MariaDB and MySQL: a one-to-many joined read breaks ties on the joined
$idonly when its rows show the join or a cursor is used. A left-joined read with a limit, no filter or search on a joined attribute and a main order ($sequenceor$idamong them) joins only the page of main documents it can reach, fulltext searches on main attributes included, instead of sorting the whole join. Inner, right and full outer one-to-many joins, filters and searches on joined attributes and orders that start with a joined attribute still sort the whole join. See Joins. - MySQL: under shared tables, an inner or left join whose own ON no index of the joined collection serves reads the
tenant's rows of the joined table once, matching its tenant as a range (
_tenant >= ? AND _tenant <= ?), instead of looking them all up again for every row the join pairs (50 s to 0.6 s for four such joins over 50 000 rows). Joins an index serves, other join types and reads spanning several tenants are unchanged.
- Permission checks no longer use
- Tooling:
- The
bin/tasks (load,index,query,relationships,operators) start again:bin/cli.phpno longer registers a resource with a class the lockedutopia-php/didoes not have, and it loads the autoloader relative to itself.bin/querybuilds its connection withUtopia\Database\PDO, like the other tasks.
- The
- A transaction begun on the adapter directly (
getAdapter()->startTransaction()) is not an invalidation scope: each write inside it invalidates the caches and firesdocument_purgebefore that transaction commits. UsewithTransaction(). - A join on an unindexed attribute is accepted, but on a large collection it can exceed the statement timeout. On MariaDB 10.11, which has no hash join and prunes the join orders it plans, a join whose ON columns are unindexed can be very slow: index the attributes your join conditions compare.
- On MySQL, left joins on a joined collection's own
$idcan be slow right after the collection is created or bulk-loaded, until InnoDB's automatic statistics recalculation has run (seconds, with the defaultSTATS_AUTO_RECALC). RunANALYZE TABLEafter a bulk load.
- Requires
utopia-php/query0.7 andutopia-php/async0.2.utopia-php/asyncrequiresopis/closure, which the library itself does not use.Utopia\Async\Serializer::unserialize()no longer decodes closure payloads; useSerializer::unserializeTrusted()for data from a trusted channel. - utopia-php/query 0.7 has one join form with a required alias (
Query::join($collection, $alias, $on)), carries join and aggregate aliases in a property (getAlias()), types cursors asarray|object, and refuses an ON list member other thanon()or a filter. Its PostgreSQL builder quotes each key of a JSON path it reads or writes, and its MongoDB builder rejects an empty field name or one that starts with$in a filter.
- The test suite fails on PHP warnings, notices and deprecations, on risky tests, and on PHPUnit's own notices and
deprecations, raised in
src/ortests/. - CI tests utopia-php/cache 5.x: a second image built with
UTOPIA_CACHE_VERSION=^5.1runs the unit suite and the MariaDB adapter tests against it. Test cache doubles declaresave(..., int $ttl = 0)so they load on 4.x and 5.x. - A slim PHPStan rule in the library's own CI rejects magic
PDOStatementproperty reads and hooked properties on the hot paths (PHP 8.5's tracing JIT miscompiles them, php/php-src#22084). Consumers are not affected. - The
bin/benchmark tasks registerHook\PermissionsandHook\Relationships, so they measure the same work as 7.4.0. composer.jsondeclares8.0.x-devas the branch alias ofdev-main, so"utopia-php/database": "^8.0"resolves before 8.0.0 is tagged (with"minimum-stability": "dev"and"prefer-stable": truein the root package).