DT
Drizzle TeamShubham-Sinha

How to implement triggers or db hooks ?

Is there a way to know if sql statement got executed successfully or not ? I wanted to run a code when row gets inserted or updated ? can custom loggers be used to implement the same ?
AS
Andrii Sherman349d ago
if there were no errors after running a query it means that statements were executed successfully or do you mean you wan to run a code after ANY insert/update? something like post-query interceptor?
S
Shubham-Sinha349d ago
Yup. I want to run a code after any insert / delete I feel there should be hooks like before insert, after inserts. This will make some of things easier and secure. Like hashing a password. Right now I have to make sure that password I’m inserting is hashed, so every function that uses user insert I’ve to do that. Instead if this can be done at every insert / update, as a developer I’ll feel more confident using user.insert wherever I want
Want results from more Discord servers?
Add your server
More Posts
noob help: INSERT with JOIN SQL to DrizzleFrontend developer dabbling with SQL for the first time in years. With the help of ChatGPT I have thOrderBy with dynamic queries dont work``` ....orderBy(sql`${products.xyz} ${order}`) ``` ``` error: syntax error at or near "$2" ``` ordeIs there a way to limit update to just 1 document?I know there will be multiple documents matching this where query, but I only want to update 1 of thHow to get InferModel to work with Relation model?Is there a way to get the infer type for a relation model? eg: type User = InferModel<typeof users,MySQL column type: "Generated"?Does drizzle support defining generated columns? https://planetscale.com/courses/mysql-for-developeAnyone else having a weird issue with drizzle-kit push:mysql?I spun up a new project using Planetscale and I got a bizarre __vtschema error (see: https://github.Performance questionsI'm using Drizzle ORM with Planetscale DatabaseJS driver and my application has spots where I want tCan drizzle generate an initial schema from an existing db?I have a db that wasn't built using drizzle, but I'm interesting in moving over to it. Do I need toPrepared StementsI was looking into using AWS RDS Proxy with Prisma and ran into this https://www.prisma.io/docs/guiReact Native SupportHi all New to drizzle ORM, does it support React Native? Thanksupdate multiple rowsHow can I update values in multiple rows at once?Running `drizzle-kit introspect:pg` returns "client password must be a string"I'm attempting to move from objection.js+knex.js over to Drizzle and I'm running `drizzle-kit intros