Skip to content

Commit efd3b9d

Browse files
hotlongCopilot
andcommitted
fix(plugin-audit): write explicit ISO timestamp on sys_activity rows
The sys_activity.timestamp column declares defaultValue: 'NOW()' as a framework convention, but the SQL driver currently stores it as a literal string instead of translating it to CURRENT_TIMESTAMP, so every audit row that relied on the default leaked the string 'NOW()' into the record and the timeline rendered 'Invalid Date'. Set timestamp explicitly to new Date().toISOString() in the audit writer so we don't depend on the driver-side resolution. Filed separately as M11 — the broader 'NOW()' default-value sweep across platform-objects (sys-comment, sys-notification, sys-presence, …) still needs the driver fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6a78c59 commit efd3b9d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/plugins/plugin-audit/src/audit-writers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ export function installAuditWriters(engine: any, packageId = 'com.objectstack.au
192192

193193
const activityRow: Record<string, any> = {
194194
type: activityTypeFor(action),
195+
// Explicit ISO timestamp — `defaultValue: 'NOW()'` on the column
196+
// isn't resolved by every driver and would otherwise leak the
197+
// literal string "NOW()" into the row.
198+
timestamp: new Date().toISOString(),
195199
summary,
196200
actor_id: userId ?? null,
197201
object_name: ctx.object,

0 commit comments

Comments
 (0)