Drizzle Team

DT

Drizzle Team

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

Join

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: {...

Schema not ingested with drizzle-orm/node-postgres

I have a db connection for production using Vercel Postgres. It works great. I'm trying to set up a dev connection to a local Postgres instance. I have the following code: ```ts...

Extract interface for table from schema

Can I extract an interface for a table from my schema without using it from the client? Something like "typeof [nameOfTable]" or something? Or do I need to define my own interfaces?

Including more than 1 relation in query throws error

If i try to include more than 1 relation i get an error 👇 ``` { "errorMessage": "could not identify an equality operator for type json", "errorType": "Hw",...

New neon http driver not working with pooled connections

is the new { drizzle } from "drizzle-orm/neon-http" not compatible with pooled connections? Getting error when I do:
const pool = new Pool({ connectionString: env.DATABASE_URL });
export const db = drizzle(pool);
const pool = new Pool({ connectionString: env.DATABASE_URL });
export const db = drizzle(pool);
...

Postgres functions

Hey, I'm migrating a ton of postgres raw sql into using drizzle ORM. Is there any sort of setup for migrating sql functions? I have a couple dozen sql functions to convert. Didn't see anything in the docs but thought i'd ask

Query issue - Syntax error at or near "$1"

Hello, I currently got this error recently: PostgresError: syntax error at or near "$1" This is the query i am trying to make. Note that this worked fine very recently. ...

Cannot drop index 'idx': needed in a foreign key constraint

So I had this table with its migration in the database: ``` export const userProfile = mysqlTable('user_profile', { id: int("id").primaryKey().autoincrement() userId: int('user_id'),...

how to use insert with select in drizzle?

```sql INSERT INTO your_table (column1, column2, column3, category_id) SELECT column1, column2, column3, new_category_id FROM your_table WHERE category_id = old_category_id;...

Using LiteFS (fly.io) with Drizzle

Hello, I was wondering if there's an example project for integrating LiteFS with DrizzleORM. This project seems very out of date (drizzle-orm: 0.12.0-beta.23). If you try and install the required drizzle-orm-sqlite npm says it's deprecated and has been merged into the main repo. https://github.com/drizzle-team/drizzle-flyio-litefs ...

NextJS Build Parameter xxx implicitly has an 'any' type.

I'm trying to build my TurboRepo NextJS app but all my trpc endpoints return any when building, VSCode autocomplete works fine. Any idea what I'm doing wrong?