Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Always use DB statement_time for journal updated_timestamp

Oliver Güntherc48bfd6a003f
diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rb
index a939be75fda..2f73e13fd4d 100644
--- a/app/services/journals/create_service.rb
+++ b/app/services/journals/create_service.rb
@@ -572,10 +572,9 @@ module Journals
end
def timestamp_sql
- # Use the ruby time instead of the DB's. If those are out of sync,
- # a journal might otherwise end up having an updated_at before created_at which
- # will also reflect back to the journaled object.
- "'#{Time.zone.now.utc.iso8601}'"
+ # Use the timestamp of the statement, not now() or statement_timestamp
+ # as they always return the same value of the start of transaction
+ "statement_timestamp() AT TIME ZONE 'utc'"
end
# Because we added the journal via bare metal sql, rails does not yet