payload.db.drizzle types #4318
Replies: 5 comments 2 replies
-
This is planned actually! Thanks for bringing this up. Converting to a roadmap discussion and marking as priority 1. Expect this to come soon! PS - someone in our Discord already figured out how to do this! https://discord.com/channels/967097582721572934/967097582721572937/1161393807414268025 |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to export/expose this in a monorepo for example? That way we’d have the advantage of querying the db directly without any http requests from any app using drizzle, right? |
Beta Was this translation helpful? Give feedback.
-
I just tried the new v3 (massive achievement, congrats 🎉) where I tried to get a typed The new drizzle hooks unlock a lot on new possibilities, but it depends a lot from having a typed schema in payload. |
Beta Was this translation helpful? Give feedback.
-
I faced the same problem and found an answer on Discord (thanks ritsu).
He also mentioned that this might be integrated into payload in the future. |
Beta Was this translation helpful? Give feedback.
-
PR with this is here! #9953 |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
Love the changes that have been introduced to the framework with the Drizzle ORM / Postgres integration.
I think It has many potential as a schema builder also,
I'm aware that with Local API you can use for example
payload.find({'collection': 'users'});
on the new docs there's a mention to accessing drizzle it works great but there's a lack of types definition on this object as it is typed asexport type DrizzleDB = NodePgDatabase<Record<string, unknown>>;
it would be great if it is typed (automatically or as part of
"generate:types"
command) so editor IntelliSense can for example auto-complete statements aspayload.db.drizzle.query.users.findFirst()
orpayload.db.drizzle.select(payload.db.drizzle._.schema.posts_locales)
etc...Beta Was this translation helpful? Give feedback.
All reactions