You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.
Is there no way to use built-in functions of my database in an update?
For example, I need to set a field to the current time. I can't use something like a formatted moment.js date representing right now because the time periods are short enough that any difference between my computer's time and the database server's time creates unstable timings.
What I need is to be able to do
.update().table('tablename').set('last_check', 'NOW()') and not have the resulting SQL built:
UPDATE tablename SET last_check = 'NOW()' WHERE (id = 2)
because the NOW() function does not run; it is evaluated as a string. Is there some way to do this? If not, I think it should be possible somehow.
The text was updated successfully, but these errors were encountered:
It appears that the option usingValuePlaceholders set to true enables what I was trying to do. I recommend adding an example of this option to the docs.
Is there no way to use built-in functions of my database in an update?
For example, I need to set a field to the current time. I can't use something like a formatted moment.js date representing right now because the time periods are short enough that any difference between my computer's time and the database server's time creates unstable timings.
What I need is to be able to do
.update().table('tablename').set('last_check', 'NOW()') and not have the resulting SQL built:
UPDATE tablename SET
last_check
= 'NOW()' WHERE (id = 2)because the NOW() function does not run; it is evaluated as a string. Is there some way to do this? If not, I think it should be possible somehow.
The text was updated successfully, but these errors were encountered: