Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: updated_ts on update set (#11611)

p0ny8b4525ecccd1
diff --git a/backend/store/instance_user.go b/backend/store/instance_user.go
index 5ed38a62ad..46c752a68b 100644
--- a/backend/store/instance_user.go
+++ b/backend/store/instance_user.go
@@ -110,7 +110,8 @@ func (s *Store) UpsertInstanceUsers(ctx context.Context, instanceUID int, instan
VALUES %s
ON CONFLICT (instance_id, name) DO UPDATE SET
updater_id = excluded.updater_id,
- "grant" = excluded.grant;
+ updated_ts = extract(epoch from now()),
+ "grant" = excluded.grant
`, strings.Join(placeholders, ", "))
if _, err := tx.ExecContext(ctx, query, args...); err != nil {
return err
diff --git a/backend/store/policy.go b/backend/store/policy.go
index 0475614814..7bfaa23813 100644
--- a/backend/store/policy.go
+++ b/backend/store/policy.go
@@ -387,6 +387,7 @@ func upsertPolicyV2Impl(ctx context.Context, tx *Tx, create *PolicyMessage, crea
ON CONFLICT(resource_type, resource_id, type) DO UPDATE SET
inherit_from_parent = EXCLUDED.inherit_from_parent,
payload = EXCLUDED.payload,
+ updated_ts = extract(epoch from now()),
row_status = EXCLUDED.row_status
RETURNING id
`,
diff --git a/backend/store/slow_query.go b/backend/store/slow_query.go
index 6c71611bc1..2925d613d1 100644
--- a/backend/store/slow_query.go
+++ b/backend/store/slow_query.go
@@ -244,6 +244,7 @@ func (s *Store) UpsertSlowLog(ctx context.Context, upsert *UpsertSlowLogMessage)
) VALUES ( $1, $2, $3, $4, $5, $6 )
ON CONFLICT (database_id, log_date_ts) DO UPDATE SET
updater_id = EXCLUDED.updater_id,
+ updated_ts = extract(epoch from now()),
slow_query_statistics = EXCLUDED.slow_query_statistics
`
diff --git a/backend/store/worksheet.go b/backend/store/worksheet.go
index 02400227bc..405d5e2f9c 100644
--- a/backend/store/worksheet.go
+++ b/backend/store/worksheet.go
@@ -358,7 +358,8 @@ func (s *Store) UpsertWorksheetOrganizer(ctx context.Context, organizer *Workshe
)
VALUES ($1, $2, $3)
ON CONFLICT(worksheet_id, principal_id) DO UPDATE SET
- starred = EXCLUDED.starred
+ starred = EXCLUDED.starred,
+ updated_ts = extract(epoch from now())
RETURNING id, worksheet_id, principal_id, starred
`
var worksheetOrganizer WorksheetOrganizerMessage