diff --git a/VERSION b/VERSION index 802f957..589268e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.109 \ No newline at end of file +1.3.0 \ No newline at end of file diff --git a/internal/services/audit/audit.go b/internal/services/audit/audit.go index 38785f4..bb35558 100644 --- a/internal/services/audit/audit.go +++ b/internal/services/audit/audit.go @@ -258,9 +258,13 @@ func (r *Repo) Cleanup(ctx context.Context, keepDays int) (int64, error) { if r == nil || r.Pool == nil || keepDays <= 0 { return 0, nil } + // make_interval(days => $1) nimmt $1 als int — sauber typisiert. Der frühere + // ($1::text || ' days')::interval-Ansatz scheiterte, weil keepDays als int + // übergeben wird und pgx int nicht als text (OID 25) encoden kann + // ("cannot find encode plan") → Cleanup lief nie. tag, err := r.Pool.Exec(ctx, ` DELETE FROM audit_log -WHERE created_at < NOW() - ($1::text || ' days')::interval`, keepDays) +WHERE created_at < NOW() - make_interval(days => $1)`, keepDays) if err != nil { return 0, err }