mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
FIX: Use correct timezone for manual SQL
This commit is contained in:
parent
a075fd46fd
commit
3132a9007b
@ -259,9 +259,9 @@ module HasCustomFields
|
||||
write_value = value.is_a?(Hash) || field_type == :json ? value.to_json : value
|
||||
write_value = 't' if write_value.is_a?(TrueClass)
|
||||
write_value = 'f' if write_value.is_a?(FalseClass)
|
||||
row_count = DB.exec(<<~SQL, name: name, value: write_value, id: id)
|
||||
row_count = DB.exec(<<~SQL, name: name, value: write_value, id: id, now: Time.zone.now)
|
||||
INSERT INTO #{_custom_fields.table_name} (#{custom_fields_fk}, name, value, created_at, updated_at)
|
||||
VALUES (:id, :name, :value, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
||||
VALUES (:id, :name, :value, :now, :now)
|
||||
ON CONFLICT DO NOTHING
|
||||
SQL
|
||||
_custom_fields.where(name: name).update_all(value: write_value) if row_count == 0
|
||||
|
Loading…
Reference in New Issue
Block a user