Replies: 2 comments
-
|
You must have figured it out by now :) the key is in WHEN |
Beta Was this translation helpful? Give feedback.
0 replies
-
To be honest, I gave up and moved on to other things hoping to circle back to this issue when I had time. Such a simple solution, I have to admit I'm a bit embarrassed I didn't think of it. LOL. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! Day 2 of SurrealDB for me, and I'm trying to figure out some common concepts I've been using for years in other relational databases.
One that I can't figure out is how to modify a record in an EVENT while it is being updated. For example, a table has a
modified_onfield that I would like to automatically update to thetime::now()during an UPDATE query.In PostgreSQL I would define a TRIGGER function which just modifies the column on the NEW record and returns is. Is there something similar in SurrealDB? I have tried to modify the field on
$beforeand$after. No luck. Copilot suggested callingUPDATE tablename SET modified_on = time::now();from within the event, but obviously this results in an infinite loop.How would I do this in SurrealDB, or is this concept achieved in a different way that I have not learned yet?
Thanks for any guidance!
Beta Was this translation helpful? Give feedback.
All reactions