Drizzle Team

DT

Drizzle Team

The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!

Join

Error when running drizzle-kit generate:mysql

I have no clue what this means ```apache ...>pnpm drizzle-kit generate:mysql drizzle-kit: v0.17.1 drizzle-orm: v0.26.5...

[Postgres] prepared with inArray & placeholder

Hello there, I can't see why It ends with an error :/ ```ts...

Transactions with postgres

So, I have my authentication set up in a way that each user 'lives' in two separate tables, Users (email and password) and Customers (more personal data) This is my registration controller: ```javascript authRouter.post('/register', async (req, res) => {...

Relational queries (PlanetScale)

Hi, does drizzle-orm/mysql2 support relational queries? I am currently using PlanetScale, but I haven't been able to find any information about relational queries in the following documents: - https://orm.drizzle.team/docs/rqb...

Tx Rollback meesage

Hey! If I throw a tx.rollback(), is there a way to specify an error message beyond "Rollback" ? I have a transaction in a try/catch block and would love to specify the failed employeeID and throw a custom error message including the employeeID whos transaction failed

Sqlite insert returning typing help

Been using this lots for PG but trying now with Sqlite. I'm confused by how tog et the returned object after inserting. It's not super clear from the docs: ``` const _company = db .insert(companies)...

Drizzle-orm for Vercel, select do not take any argument?

Hi, I want to deploy to Vercel my small app made in Qwik, it seems like Vercel edge do not support Prisma so I migrated to drizzle but I'm facing an odd problem, the vercel package of drizzle expose a .select() without any argument, for example I would like to take only some columns of an entity, and more importantly I want to be able to return a COUNT of the elements, without it I would need to load the entire table 😦

Migrating from Prisma to Drizzle - What would be helpful to track for a before / after?

Heyo, I’m migrating @Answer Overflow from Prisma to Drizzle and since it’s a project in production I figured it might be nice to get some real world data from the migration. My main reasons for swapping over is to run on edge, cut my bundle size, and use the HTTP planetscale driver, and have the sql query builders. Also I like the name more From the perspective of the Drizzle devs, is this something that’d be valuable to track for a before / after to have for Drizzles’ marketing / docs / blogs or is it not really needed?...

Refetching?

Hello I just put up an app using Next 13 app directory and I decided to give Drizzle a try. Everything went great but my data (fetched in a RSC and passed into a client component) is stale. I added new rows to the db, but Drizzle does not refetch. I searched docs and couldn't find an answer. What's the best way to go about refetching periodically?

Count, Distinct, etc (postgres)

Where can I find documentation for these kinds of db operations? I'm using drizzle with postgres-js Thank you...

Query/select statement of column via sql`` for extras field

is it possible to make a normal select to another table inside a extras object in a relational query? i'm trying to do something like this: ```ts...

onConflictDoUpdate array

Hi, is it possible to upsert/update an array? ```ts await db.insert(organizations).values(organizationsResponse.organizations).onConflictDoUpdate({ target:[organizations.id], set:{...

Relational queries for editing?

Relational queries look great, but they are just for reading data right? Nothing like updateOne or deleteOne etc right?

Is there a way to dynamically edit a query with the builder?

I am using drizzle and I love it, but, coming from knexjs, I am missing a lot this feature: https://knexjs.org/guide/query-builder.html#modify Is there a way to do the same in Drizzle?...

When trying to push:mysql its warning that schema has changed and data will be lost when it hasnt.

· You're about to change projected_points column type from alter_table_alter_column_set_type to decimal with 689 items
THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
· You're about to change projected_points column type from alter_table_alter_column_set_type to decimal with 689 items
THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
No changes have been made ......

Invalid input value for enum

I have this enum definition as below and whenever I’m to make a request to save a data of the kind of the enum I always get back invalid input value for enum auth_type: “Form”, where as my enum was defined with uppercase. But if I use “form” it will accept it. Const authTypeEnum = pgEnum(“auth_type”, [“Form”, “Google”]); What could be the issues of this error?...

Share migrations in monorepo

I am using drizzle in a monorepo (npm workspaces with turborepo) within an internal package that is shared among multiple apps. It basically exports a bunch of functions that use drizzle behind the scenes. This works great, however I can't run migrations from within the apps that use the package, because the folder with the migrations is only available inside the package that contains drizzle. I would love to run the migrations on app startup using migrate from drizzle-orm/postgres-js/migrator like shown in the examples, but then I get the error that the migrations can't be found. The only solution I figured so far is to copy the migrations from the shared package to every app directory every time when I ran drizzle-kit generate. Can you think of any better solutions?...

Top-level await is not available in the configured target environment ("node14")

```typescript import type { Config } from "drizzle-kit"; import { getDbUrl } from "./src"; ...

How to migrate changes to a table

I'm trying to read up on drizzle and the first question that come to mind was how does migration works with database changes? The docs, https://orm.drizzle.team/docs/migrations, only shows the initial first migration. How are changes treated and what are the recommended way of doing them? Do I just update the schema.ts file and drizzle figure out what migration I need to run?

Postgres-js Migrate - Error: Can't find meta/_journal.json file [SOLVED]

I've gotten drizzle setup and running but I'm unable to run any migrations. I'm using postgres-js and created a migrate.ts file that i'm executing. Here is my code:...