mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(audit): stop duplicate and empty audit rows
- Set env var version and compose parsing version while creating, so a create writes one row - Record no rows for the auto-created preview copy of an env var - Record env and application API updates only with the fields that really changed - Store no change data for new env vars, and null for empty change data - Store metadata team_id as an integer - Drop the unused level and resource indexes of audit_events Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
13298591d8
commit
b7d0e6be2a
@@ -123,7 +123,7 @@ class AuditEvent extends Model
|
||||
*/
|
||||
public static function recordModelMutation(string $event, array $context, array $changes): void
|
||||
{
|
||||
self::recordWithChanges($event, $context, $changes);
|
||||
self::recordWithChanges($event, $context, $changes ?: null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,6 +161,11 @@ class AuditEvent extends Model
|
||||
*/
|
||||
private static function attributesFor(string $event, array $context, ?array $changes, string $level): array
|
||||
{
|
||||
// API tokens store team_id as a string. Keep it an integer, so JSON filters on metadata work.
|
||||
if (is_string($context['team_id'] ?? null) && ctype_digit($context['team_id'])) {
|
||||
$context['team_id'] = (int) $context['team_id'];
|
||||
}
|
||||
|
||||
$teamId = data_get(auth()->user()?->currentAccessToken(), 'team_id')
|
||||
?? (array_key_exists('team_id', $context)
|
||||
? $context['team_id']
|
||||
|
||||
Reference in New Issue
Block a user