Skip to content

feat: adapt audit schema to query-lib Attribute and Index VOs - #133

Open
abnegate wants to merge 9 commits into
mainfrom
feat-query-lib
Open

feat: adapt audit schema to query-lib Attribute and Index VOs#133
abnegate wants to merge 9 commits into
mainfrom
feat-query-lib

Conversation

@abnegate

@abnegate abnegate commented Aug 21, 2026

Copy link
Copy Markdown
Member

Required by appwrite/appwrite#11649 and appwrite-labs/cloud#5410. Depends on utopia-php/database#823.

Why this approach

Database::createCollection() takes a Collection only. Audit setup now passes new Collection(id:, attributes:, indexes:) built from typed Attribute/Index factories.

Composer pins utopia-php/database to dev-feat-query-lib as 7.0.0 (808f90bf).

Verified

  • Pint on the Collection wrap

Not verified

  • CI on d552413 after the Collection-only wrap

Needed so Appwrite can take main's queue 1.3 pin.
Take main's validators ^0.5 pin and refresh database feat-query-lib so Attribute/Index/ColumnType stay current.
ClickHouse was mutating parent Attribute/Index instances in place.
MariaDB tests were also losing event=delete rows because persistent
PDO plus a new adapter per PHPUnit setUp rolled back uncommitted writes.
@github-actions

Copy link
Copy Markdown

Thanks for contributing! This repository is a read-only mirror; development for this library happens in packages/audit in the utopia-php monorepo. Please open this pull request there instead.

@github-actions github-actions Bot closed this Aug 21, 2026
@abnegate abnegate reopened this Aug 21, 2026
@abnegate

Copy link
Copy Markdown
Member Author

@greptile-apps review

@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown

Greptile Summary

The PR migrates audit schemas and query handling to the typed value objects and method enums provided by the updated Utopia database/query libraries.

  • Replaces array-based attribute and index definitions with Attribute and Index value objects.
  • Passes a typed Collection into database setup.
  • Updates ClickHouse schema translation and query handling for the new value-object APIs.
  • Expands query-library compatibility and refreshes the locked dependency graph.
  • Updates adapter and query tests for typed schema properties and enum-backed methods.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
composer.json Switches the database dependency to the query-lib development branch, permits query 0.4/0.5, and adds VCS repositories.
composer.lock Locks the development database revision, query 0.5.0, and the resulting transitive dependency updates.
src/Audit/Adapter/SQL.php Replaces shared array-based schema definitions with typed Attribute and Index value objects.
src/Audit/Adapter/Database.php Adapts collection setup and query-method comparisons to the updated database and query APIs.
src/Audit/Adapter/ClickHouse.php Migrates ClickHouse schema inspection, construction, and query dispatch to typed value objects and method enums.
src/Audit/Query.php Adds compatibility constants and enum-backed factory overrides around the shared query implementation.
tests/Audit/Adapter/ClickHouseTest.php Updates schema assertions and test naming for value-object attributes and indexes.
tests/Audit/Adapter/DatabaseTest.php Disables persistent PDO connections in the database adapter test setup.
tests/Audit/QueryTest.php Updates query assertions for enum-backed method values.

Reviews (7): Last reviewed commit: "(chore): allow utopia-php/query 0.5" | Re-trigger Greptile

Schema definitions with a known column or index type now use
Attribute::string() / Index::key() instead of the generic
constructors plus ColumnType / IndexType.
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.
@abnegate

Copy link
Copy Markdown
Member Author

@greptileai review

@abnegate

Copy link
Copy Markdown
Member Author

@greptile-apps review

Force re-review of HEAD 348a4f8. Description updated for factories and caret lock refresh.

Database::createCollection no longer accepts a string id.
Database feat-query-lib now requires query ^0.5 after nested joins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant