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 deploying migrations with GH Action in Cloudflare D!

I'm trying to run migrations within a turborepo against a Cloudflare D1 instance. The command to run is this: wrangler d1 migrations apply d1_turbolang --preview I can run it from local (VS code) but when put it into an Github Action I get this error...

0.27.2 mysql:push

mysql:push in 0.27.2 is trying to alter my primaryKey with no schema changes. it also seems to try and drop a constraint that doesn't exist yet? I think it's something to do with the unique index changes...

Creating an abstract base repository

Hi, I'm trying to create a base repository for my application but can't make it work. Is it even possible? Here is what I'm trying to do: ```ts...

XCannot be named without a reference to '../../../../../db/node_modules/drizzle-orm/driver.d-f4e534

I have a monorepo with a dedicated database package that handles everything around the database, and then exports a db "connection" object , and also some ORM methods. I associated packages ... I get this error when importing from that package ... any ideas welcome.

How to do conditional joins with the query builder?

Hi, I'm looking for a way to do conditional join's without working with AnyPgSelect. Thanks in advance.

Custom column type with default not working?

I tried to add a new column with a custom type and a default value. but for some reason when I tried to db push, it warned me that it didn't have a default value and that it would truncate the tables. Am I doing something wrong? ```ts const unsignedBigInt = customType<{...

testing best practices

Can anyone share how they're writing tests that involve drizzle? Looking for something similar to these docs for Prisma: https://www.prisma.io/docs/guides/testing/unit-testing...

supabase workflow

Hey I'm trying to set up a sveltekit app with supabase + drizzle and currently what I got going is a schema file in /src/lib/db and a
drizzle-kit generate:pg
drizzle-kit generate:pg
script in package.json. Currently I am generating migration whenever I change schema and then copying the migration generated into the SQL Editor in supabase's website to change my db. Is there a command for letting drizzle handle the pushing for me? I know
drizzle-kit push
drizzle-kit push
doesnt support postgres yet so that one is out the win...

Error: self signed certificate in certificate chain

Hello, I am a new user of drizzle and trying to run the command for the first time:
drizzle-kit introspect:pg
drizzle-kit introspect:pg
But I got this error...

insert with InferModel not working

Hey, playing with Drizzle, like it a lot but I am having an issue where I inferred the model of a schema as type NewUser = InferModel<typeof Users, "insert">; and try to insert. It doesn't give an error, simply does nothing. In my app I have it do many different selects so I know the schema is fine and everything is connected and working. Yet when I execute this insert nothing is added to the db.
```js import { InferModel } from "drizzle-orm"; ...

mysql-core fails on TS build on 0.27.1

Getting this error when I try to build my ts node app

Use a different schema on postgres

Hello, I am currently trying to define a table with drizzle like this: ```typescript const rollupAccountResponsesDaily = pgTable('rollup_account_responses_daily', { rollupDate: timestamp('rollup_date', { withTimezone: true }),...

Specifying foreign key names in Schema

After introspecting from a database, and generating new schema with changes, the existing foreign key constraints get dropped and readded (arguably with a better name, but ignore that <a:pepe_shy:865718902628548618> ) is there a way to avoid/bypass this behaviour? for example, by manually specifying the name of the constraint in schema...
No description

Internal server error: Error connecting to database: fetch failed

I'm trying to send the following query to my db but it eventually times out, throwing an error: ```typescript const currentCity = await db.query.city.findFirst({ where: and(...

ERR_PACKAGE_PATH_NOT_EXPORTED on 0.27.1

I'm getting the following message using drizzle-orm 0.27.1. I've tried using various different node versions but currently on 18.16.1. Also tried rm -rf node_modules and pnpm i but still no change. I see there was another post back in 23 Apirl 2023 but couldn't find any helpful information on there. Any ideas?
No description

Error: Error connecting to database: fetch is not defined

Trying to use neon-http with SST ``` import { neonConfig, neon, Pool } from "@neondatabase/serverless"; import { drizzle } from "drizzle-orm/neon-http";...

good way to get the "count" for paginated queries

I'm doing the following to get the total count and the values in a paginated query: `` const fileCountRes = await ctx.db .select({ count: sql<number>count(*)`.mapWith(Number),...

Sqlite3 support for Deno

Apologies if I'm being dense, but is there support for deno with a local sqlite3 db? I can't seem to get better-sqlite3 working in Deno. TIA...

postges, auto-generated uuid as primary key

I'm looking to change all my tables from having a serial int primary key as ID what is the best way for generating the column definition in the drizzle schema file? Thank you...

Relational query `extras` are not properly adding sql

When I try to use the drizzle orm relational query like it is show in the docs I run into an error. Rather than taking the sql that I say and then adding as to alias the value it just requests the alias. ```ts const data = await db.query.user.findMany({ columns: {...