-
Notifications
You must be signed in to change notification settings - Fork 9
feat(clickhouse): rename actor columns in ClickHouse adapter only #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
490b2d6
b3b663c
735b2a0
39f47b5
5e58c5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to `utopia-php/audit` are documented in this file. | ||
|
|
||
| ## 2.4.0 | ||
|
|
||
| ### ClickHouse adapter — actor terminology | ||
|
|
||
| The ClickHouse adapter now stores its principal columns under "actor" terminology: | ||
| `actorId`, `actorType`, `actorInternalId`. The shared SQL base, the Database adapter, | ||
| and the public `Audit` API are unchanged — Database-backed audit logs continue to use | ||
| `userId`. | ||
|
|
||
| This is a non-breaking change for callers of the public API. `Audit::log($userId, ...)`, | ||
| `Audit::getLogsByUser(...)`, `Audit::countLogsByUser(...)`, and the equivalent | ||
| `*ByUserAndEvents` methods all keep their original signatures. The ClickHouse adapter | ||
| translates the legacy `userId` array key and `Query::equal('userId', ...)` filter | ||
| internally to the renamed `actorId` column. | ||
|
|
||
| #### Added | ||
|
|
||
| - `Log::getActorId()`, `Log::getActorType()`, `Log::getActorInternalId()` getters for | ||
| ClickHouse-backed log reads. | ||
| - `Log` instances returned by the ClickHouse adapter expose both `actorId` / `actorType` | ||
| / `actorInternalId` (canonical) and `userId` / `userType` / `userInternalId` (legacy | ||
| mirror) attribute keys so existing code paths continue to work. | ||
|
|
||
| #### ClickHouse schema changes | ||
|
|
||
| - Column `userId` → `actorId` | ||
| - Column `userType` → `actorType` | ||
| - Column `userInternalId` → `actorInternalId` | ||
| - Index `idx_userId_event` → `idx_actorId_event` | ||
| - Index `_key_user_type` → `_key_actor_type` | ||
| - Index `_key_user_internal_id` → `_key_actor_internal_id` | ||
| - Index `_key_user_internal_and_event` → `_key_actor_internal_and_event` | ||
|
|
||
| #### Migration | ||
|
|
||
| ClickHouse audit tables will be recreated by `setup()` with the new column names. | ||
| Existing ClickHouse audit data is not preserved automatically — this is acceptable | ||
| because the activity-events surface backed by this schema is not yet in public use. | ||
| If preservation is needed, run `ALTER TABLE ... RENAME COLUMN` for each renamed | ||
| column before redeploying. | ||
|
Comment on lines
+40
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| No migration is required for Database-backed audit logs. The Database adapter | ||
| continues to write and read `userId` columns and indexes unchanged. | ||
|
|
||
| ## 2.3.2 and earlier | ||
|
|
||
| See git history. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CHANGELOG header says
2.4.0and explicitly states "This is a non-breaking change for callers of the public API," but the PR title uses thefeat!conventional-commit prefix, says "BC break," and states the next tag should be3.0.0. Additionally, the PR description's renames table listsAdapter::getByActor(),Audit::getLogsByActor(), etc. — but none of those method renames appear in the code;Adapter.phpandAudit.phpstill exposegetByUser,countByUser,log(?string $userId, ...). A consumer reading the PR description will look forgetByActor()and find it absent. Before merging, the CHANGELOG version and the PR description must agree: either the ClickHouse-only schema rename is a non-breaking 2.x release (matching the code), or the public PHP API methods still need to be renamed to make this a true 3.0.0 BC break.