S
stramel•319d ago
you can add the
.onUpdateNow()
call to it.
I'm doing something similar:
It may not be supported by some db providers such as planetscaleE
eatmoose•308d ago
this doesn't exist
J
Jim•307d ago
https://github.com/drizzle-team/drizzle-orm/commit/99df063e2f9c9de1c5090bd920f7bc670415741c it does, make sure you have updated your drizzle packages
E
eatmoose•306d ago
im on the latest orm version, still giving type error that it doesnt exist
@.3819
J
Jim•305d ago
What driver are you using?
AP
A. Perkamentus•305d ago
Planetscale advices to update these values on app level, because if you use mysql functions like: "NOW()" or "CURRENT_TIMESTAMP()" they will use the mysql server time and timezone. If you want to use the timezone of your own app. set these values at app level.
My Schema TS file:
When creating my record:
When updating:
E
eatmoose•298d ago
postgres
beep boop
D
dandadan•298d ago
postgres does not have a feature like that sadly
it can be achieved with triggers, but thats a database layer feature and not really recommended
on the contrary, mysql seems to have some tools to automatically update timestamps
the previously mentioned function
onUpdateNow()
is probably available for mysql only
in order for drizzle to support this for postgres they would have to add a module on top of every insert and pass the date there
personally, i believe adding that into drizzle would sort of defeat the purpose of drizzle as a typesafe orm on top of drivers
the feature does not exist in postgres and drizzle should only provide whatever is available for the database driver youre usingE
eatmoose•298d ago
Ah ok. Yeah I prefer code first approach. I really don’t like adding triggers or functions I can’t see in my code
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.1KMembers
View on DiscordWant results from more Discord servers?
More PostsRelational query erroring on workers + D1Only able to get relation queries to work while running the worker in local mode.
While running remInfer return type for relational query with paginationI have created a function that can paginate data for relational queries, problem is i cant figure oHow 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 whnoob 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 introsnoob help : transaction not acid```
return await this.drizzle.db.transaction(async (trx) => {
const u = await trx
.seExplicit inferred types```ts
async loginWithGoogle(user: NonNullable<Request['user']>) {
const existingUser = await thiMany-to-Many where in far tableI'm trying to `findMany()` Pokemon(s) by a type name
```
pokemons pokemonsToType Cannot call onConflictDoNothing() or on onConflctDoUpdate() on selectHello guys, this is probably right in front of me, but when I insert at the end of values I cannot fTop-level await is not available in the configured target environment ("chrome87", "edge88", "es2020Hey I just upgraded to the v^0.26.2 and I get the following error:
```
Top-level await is not avai