Feat: tenant per log in Clickhouse adapter#109
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe ClickHouse adapter (src/Audit/Adapter/ClickHouse.php) was refactored to centralize insertion logic. create() now delegates to a new public createBatch(array $logs): bool by wrapping a single log. createBatch handles per-log id assignment (uses provided id or generates one), time formatting via formatDateTime, tenant resolution from log['$tenant'] or the adapter, schema attribute mapping, and encodes remaining fields into the data column before performing a JSONEachRow batch insert. getById() and find() keep their retrieval behavior with minor docblock edits. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
src/Audit/Adapter/ClickHouse.php
Outdated
| $logId = uniqid('', true); | ||
| // Generate ID if not provided | ||
| $logId = $log['id'] ?? uniqid('', true); | ||
| assert(is_string($logId)); |
There was a problem hiding this comment.
Let's if/throw instead of assert, whether assertions do anything depends on PHP flags
Summary by CodeRabbit
New Features
Bug Fixes