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 while push:sqlite after update

I am getting this error while using
npx drizzle-kit push:sqlite
npx drizzle-kit push:sqlite
here is drizzle.config.json ``` {...

What do i do when introspection gives an error?

drizzle-kit introspect:pg --config drizzle.config.ts drizzle-kit: v0.19.1 drizzle-orm: v0.27.0 length: 352, severity: 'ERROR',...

introspect schema generation forgets import

introspect schema generation doesn't add import for smallint

.get() returning only one element

Hey I am using DrizzleORM with Turso and I am having a problem thath this query return only one element, not a list of objects. How? export async function GET(req) { const page = req.query?.page ? parseInt(req.query.page) : 1; const limit = req.query?.limit ? parseInt(req.query.limit) : 10; ...

Cursor pagination on table using UUID as primary key

Hello everybody! We've switched from Prisma and are trying to implement cursor pagination. It turns out our tables are using UUID instead of integers as primary keys. I couldn't find anything on Drizzle's documentation about it. Even Google search didn't return a result. Could someone here provide guidance? Thank you very much!

createdAt and expiresAt defaults

Is this the best way?
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
expiresAt: timestamp('expires_at', { withTimezone: true }).default(sql`(now() + interval '7 days')`),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
expiresAt: timestamp('expires_at', { withTimezone: true }).default(sql`(now() + interval '7 days')`),
...

Delete using pg query in drizzle

Hello guys, is there any way to implement following query in drizzle? ``` DELETE FROM CustomerVehiclePart AS a USING CustomerVehicle AS b, Vehicle AS c...

Using postgres connection for cockroachdb

Hello everyone, would it be possible to use postgres for cockroachdb? Or is there maybe something that I need to change in order for it to be compatible?

Drizzle in vscode Ts Server is very slow

please check the video, when i type something it took around 5-6 seconds to get the auto suggestion. i am on windows and a have attach my processor and ram configuration also. let me know if i am doing anything wrong

Running parallel queries

I thought I could be clever with something like this to speed up an endpoint with several queries: ```return await ctx.drizzle.transaction( async (tx) => { const threadId = nanoid();...

drizzle.config.ts issues with ESM

Today's release of drizzle-kit, version 0.19.1, added drizzle-kit's ESM support and resolved this GH issue: https://github.com/drizzle-team/drizzle-kit-mirror/issues/55. Now, resolving imports with a '.js' extension, such as
import { table2 } from './table2.js';
import { table2 } from './table2.js';
works, except for in the drizzle.config.ts file, where it will still throw an error
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
. The only solution I could think of was updating my tsconfig.json to include drizzle.config....

Full Text Search

Is it possible to add full text indexes in Drizzle (MySQL)? If not, can we expect it to be supported in the future?

Same data is returned if I change the data without using Drizzle.

I have a telegram bot that queries SQLite database. Everything works as expected until I change data using my database UI client (DataGrip) directly. If I do this the data that the bot gets is not changed. Restarting the bot helps which makes me thinking there is some king of caching going on. Is it expected? If so, can it be disabled? Here are the versions of the ORM and the driver i'm using: ``` "drizzle-orm": "^0.25.4"...

drizzle-kit generate:pg throws ERR_INVALID_RETURN_PROPERTY_VALUE

I have my drizzle.config.ts file unchanged (besides adding driver) from before the recent update (see below), but after updating to latest I am getting an error: TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected a url string to be returned for the "url" from the "drizzle-kit/loader.mjs 'resolve'" function but got instance of String. ```ts import { Config } from 'drizzle-kit'; ...

How to do migrations that require data changes?

Hi, how can I migrate a live database that requires to do a more complicated data shuffling, e.g. I have this schema: ```typescript const Pages = pgTable('pages', { id: uuid('id').defaultRandom().primaryKey(), title: text('title').notNull(),...

Typescript Problem, do you have an idea ?

Property 'user' does not exist on type 'DrizzleTypeError<"Seems like the schema generic is missing - did you forget to add it to your DB type?">'.ts(2339)`import * as schema from './schema'; import { drizzle } from 'drizzle-orm/...'; const db = drizzle(client, { schema }); ...

How do I use "the connection pooler"?

On the docs for Supabase, it says "Connect to your database using the Connection Pooler for serverless environments" but without elaborating. How do I do this? The postgres package does talk about it, but it doesn't seem to mention anything about how to do that vs a direct connection...

dynamic relational queries column returns

Hi I'm not entirely sure if this is the intended result when trying to make a relational query. ```ts //type is derived from a mysql table type User = {...

Error updating a record

I'm getting an error typescript: Cannot find name 'buildings'. Did you mean 'buildingId'? [2552] when trying to update an item ```ts import * as schema from "@/drizzle/schema" import { PostgresJsDatabase, drizzle } from "drizzle-orm/postgres-js"...

using postgres-js for connection

I am trying to setup drizzle with postgres-js package ( as document it be fastest). Referring to this doc: https://orm.drizzle.team/docs/installation-and-db-connection/postgresql/postgresjs How do i define schema using postgres-js ?? I tried import for table to my schema file and typescript shows error: Module '"drizzle-orm/postgres-js"' has no exported member ... ...