feat: adapt migration schema calls to query-lib value objects - #222
feat: adapt migration schema calls to query-lib value objects#222abnegate wants to merge 15 commits into
Conversation
Published 2.0 still used Database::VAR_* and positional createAttribute/createIndex, which feat-query-lib removed. Rebase onto main and pass Attribute/Index/Relationship VOs plus ColumnType/IndexType so Appwrite can pin this branch as 2.0.0.
Appwrite stores ColumnType::BigInteger as biginteger. CSV export resolved that as an unsupported column type and wrote no rows.
createDocument can return an empty Mongo sequence while a subsequent
getDocument has the ObjectId. Creating database_{seq} from the create
return left table import looking up a collection that did not exist.
Appwrite main added huggingface as a project OAuth2 provider. Without an allow-list entry, Appwrite-to-Appwrite migrations fail on that provider even when the rest of the transfer succeeded.
Keep query-lib APIs and the huggingface PROVIDERS allow-list already on main.
Appwrite #11649 locks database at 5719edd. Staying on e593b78 would only prove the schema VO calls against an older query-lib surface.
Greptile SummaryThe PR updates migration schema operations to use query-lib and database value objects while adapting source normalization, destination creation, and tests to the revised APIs. The follow-up changes also complete failed-database recovery under the default duplicate policy.
Confidence Score: 5/5The PR appears safe to merge. The previously reported failed-database retry defect is resolved: failed metadata now enters overwrite recovery even under the default duplicate policy, recreates a missing backing collection, and transitions to ready only after successful completion. Important Files Changed
Reviews (9): Last reviewed commit: "(refactor): use Schema\Order and wrap Co..." | Re-trigger Greptile |
utopia-php/database feat-query-lib keys silenced events with Coroutine::getCid(). The CI image is vanilla PHP, so Memory-adapter tests fatalled before they could run.
createDocument can persist a row whose subsequent getDocument is empty. That throw sat outside the failed-status handler, so a later skip could flip the unusable database to ready without a backing collection.
|
Addressed the reload-failure finding.
Reload + Also stubbed @greptile-apps review |
Asterisk wildcards on utopia-php packages are replaced with equivalent caret constraints so Composer ranges stay consistent.
Keep composer.json and composer.lock in sync so `composer validate` passes, and pin utopia-php/database to the current query-lib HEAD.
|
@greptileai review |
|
@greptile-apps review Force re-review of HEAD |
Database::createCollection no longer accepts a string id.
Database::checkAttribute now requires Attribute. Build schema models from the resource key so metadata document IDs are not used as attribute keys.
Appwrite E2E migrations failed because checkAttribute now requires Attribute, and the destination still handed it a metadata Document.
A reload failure leaves a metadata document in `failed` with no backing collection. Recovery only ran when onDuplicate was not Fail, so the default policy retried createDocument against the existing ID and stranded the database.
|
@greptileai review |
Index types already used IndexType; column direction was still a raw ASC string. Collection constructors with multiple named params were also jammed on one line.
Required by appwrite/appwrite#11649 and appwrite-labs/cloud#5410. Depends on utopia-php/database#823.
Why this approach
Database::createCollection()takes aCollectiononly. Destination Appwrite now wraps collection id/attributes/indexes (and named permissions/documentSecurity) innew Collection(...).Composer pins
utopia-php/databasetodev-feat-query-lib as 7.0.0(808f90bf).Verified
Not verified
f2de906after the Collection-only wrap