Drizzle Team

DT

Drizzle Team

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

Join

Enum Type Creation

Having a small issue where when I run generate, my enum type is not being created, giving, an error when migrating: This is at the top of the schema. ```ts...

TS2353: Object literal may only specify known properties, and where does not exist in type

Hello everyone! I have an error when trying to create a nested filter. ``` export const user = pgTable('users', { id: uuid('id')...
No description

Double nested return giving type error but works in run time

```ts const result = await db.select({ nesting_one_level: { nesting_two_level: { ...getTableColumns(MyTable)...

drizzle seed with postgress this error: Cannot find package '@electric-sql/pglite'

``` import { drizzle } from 'drizzle-orm/node-postgres' import { reset, seed } from 'drizzle-seed' import { user } from '../schema'...

indexes with pgTable deprecated

Using drizzle-orm: 0.36.0 I followed the docs creating indexes: https://orm.drizzle.team/docs/indexes-constraints#indexes--constraints However i'm getting a warning concerning a deprecated use of pgTable. Here's my code:...

How to query join table with db.query syntax?

Here is my schema for User, Library and LibraryUser tables.. ```typescript import { relations } from "drizzle-orm"; import { uniqueIndex, uuid, varchar } from "drizzle-orm/pg-core";...

Local Testing for D1?

before, to test locally with drizzle and d1: ```json "gen-local-db": "npx drizzle-kit generate:sqlite", "init-local-db": "npx wrangler d1 execute clients --local --file=$(ls ./drizzle/*.sql| head -1)"...

Error: connect ETIMEDOUT

Hello, I am new to drizzle orm. I used it to establish connection with my AWS RDS instance. I've been able to use the Drizzle Studio to monitor my RDS instance. However, I just get this connect ETIMEDOUT error recently which I don't really know where to start fixing. Attached are my stack trace and error context. Thanks in advance

Is this query possible using the Query API?

I have this query:
db.query.usersTable.findFirst({ with: { userDetails: true }, where: eq(userDetailsTable.email, email) });
db.query.usersTable.findFirst({ with: { userDetails: true }, where: eq(userDetailsTable.email, email) });
but when ran it throws the error column usersTable.email does not exist even though I'm trying to filter based on userDetailsTable. Is this query not possible using the Query API or am I just doing it incorrectly?...

Multiple DBs?

I am planning a new feature at work to make use of multiple databases on the same RDS cluster. Each DB will have a separate schema. Can drizzle handle querying multiple databases? Does anyone have a good example of using Drizzle with the MySql driver configured to query across multiple DBs?...

Schema building

I want to archive the content for a scholar who writes a series of posts related to a single subject, this series will have different shape for it's posts than other serieses. for example a series of posts have a verseId, chapterId, point_1, point_2, point_3. another series posts may look like this: characterName, content. And there will be a serieses created in the future I need some help and ideas on how to achieve that....

MySQL support

Hey 👋 I'm trying to use drizle kit migrate which is causing me a lot of issues I'd appreciate some support over this. (PART OF) SCHEMA: ```ts export const user = mysqlTable('user', { id: serial('id').primaryKey(),...

Query Builder Mutation Behavior

is it expected that doing something like
const paginatedQuery = qb.limit(pageSize).offset((page - 1) * pageSize);
const paginatedQuery = qb.limit(pageSize).offset((page - 1) * pageSize);
...

Circular Reference in Schema Relation

I'm trying the following: ```ts export const pages = pgTable("pages", { ...shared, // primaryMetadataId: uuid()...

Supabase [users.id]

I ran drizzle-kit pull to get my existing schema from Supabase. The schema output included the following ``` export const notifications = pgTable("notifications", { id: uuid().defaultRandom().primaryKey().notNull(),...

Making a simple dictionary

i have added DictionaryTitle and Dictionary on the schema and im lost T^T .... i want to connect them so when i click the title it should go in to a new page for the definition of that title is
No description

Error With types from Drizzle

Since i upgraded to latest version of drizzle i am not getting any types and alot of errors. Example:
Property 'config' is protected but type 'Column<T, TRuntimeConfig, TTypeConfig>' is not a class derived from 'Column<T, TRuntimeConfig, TTypeConfig>'
Property 'config' is protected but type 'Column<T, TRuntimeConfig, TTypeConfig>' is not a class derived from 'Column<T, TRuntimeConfig, TTypeConfig>'
drizzle-orm: "0.36.3" drizzle-kit: "0.28.1" ...

Migration Order Question

Hey team - I'm trying to understand migration order as I keep running into the annoying error
error: column "created_by_api_key_id" referenced in foreign key constraint does not exist
error: column "created_by_api_key_id" referenced in foreign key constraint does not exist
...

What type to use for a batch item

I'm trying to type the array used to hold queries to be batched with the batch API. ``` const queries: ??? = []; ...

serial('id').primaryKey() vs primaryKey() in extraConfig?

Are there any implications with marking a column as a primary key through the extraConfig argument as opposed to on the column definition? If I define a column like the following, everything seems to behave fine, but I do see that in the snapshot that drizzle marks the column as primaryKey: false and instead considers this a composite PK ```typescript...