Drizzle Team

DT

Drizzle Team

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

Join

pushSchema from drizzle-kit/api is not working if pgSchema specified in the schema.ts file

Hey, I'm trying to apply migration file to a custom schema using this approach (https://orm.drizzle.team/docs/schemas). If I'll specify pgSchema in schema.ts file the pushSchema still tries to apply to the default public schema ignoring the pgSchema declaration: my schema.ts: ``` export const schema = pgSchema('custom_schema_name');...

Generic base repository abstract class

So, I’m trying to create a base repository class to extend based on my schema definitions, thing is I’m having trouble getting the types to work, here is my example ```import type { InferSelectModel, SQL } from 'drizzle-orm'; import type { AnyPgTable } from 'drizzle-orm/pg-core'; ...

LibsqlError: SERVER_ERROR: Server returned HTTP status 404

Hi guys, anyone else getting this error on running large migrations? ``` try { const response = await db.transaction(async (tx) => {...

Order By Relational Data

I'm testing out the new relations API and have a slight issue but I'm not sure if this is a limitation of the querying API or if I'm just missing something. The scenerio is that I have 2 tables with a one-to-one relationship between them on a column. For instance: ```...

TypeError: Cannot read properties of null (reading 'constructor')

Attempting to do drizzle-kit generate, getting errors which I'm struggling to debug. Confirmed with colleague on same branch of the project, working on their machine. Done fresh installs of Drizzle-orm and Drizzle-kit, both locally and globally. Versions tried: ...

can't push changes to SQLite database

Hey folks I had the following schema ```ts import { createId as cuid } from "@paralleldrive/cuid2"; import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; import { relations, sql } from "drizzle-orm";...

How to use in browser environment?

Hi, I'm trying to use Drizzle ORM in browser with wa-sqlite, a SQLite WASM lib. There are no drivers for it. How can I use it? I made my db execute function, which takes an sql string and a params array which I can basically call from Drizzle query builder / sql tag. I mean the output of these:...

How to deal with conflicts in db migrations between environments

Recently, our prod and staging environments got out of sync as we had to hotfix some fixes into prod. However, this now means that we have different migrations with the same number in 2 different environments that we now need to reconcile. Sample timeline 1. Staging and prod are both at migrations 33 2. Feature work gets deployed to staging, at migration 34...

Error Handling In Drizzle

I'm very new to drizzle, but like the feel of it, and the simplicity it provides. One thing that I am wondering about is error handling. How to I tell when querys fail and get information about it? I can't seam to find much about this online. Thanks!

drizzle-seed thinks I'm not using MySQL.

Error: The drizzle-seed package currently supports only PostgreSQL, MySQL, and SQLite databases. Please ensure your database is one of these supported types
at seedFunc (/Users/user/Code/starter/node_modules/src/index.ts:393:9)
at SeedPromise.then (/Users/user/Code/starter/node_modules/src/index.ts:167:10)
Error: The drizzle-seed package currently supports only PostgreSQL, MySQL, and SQLite databases. Please ensure your database is one of these supported types
at seedFunc (/Users/user/Code/starter/node_modules/src/index.ts:393:9)
at SeedPromise.then (/Users/user/Code/starter/node_modules/src/index.ts:167:10)
...

Error when fetching data from database view

The error I am getting when I am trying to fetch data from database view is NeonDbError: invalid input syntax for type integer: "NaN" The schema of database and view is ```...
No description

Can a CHECK constraint take sql builders (eq, lt, isNull)?

The types say these output SQL | undefined, while the check takes in SQL, so there is a type mismatch. The docs use ```import { sql } from "drizzle-orm"; import { check, int, sqliteTable, text } from "drizzle-orm/sqlite-core"; export const users = sqliteTable(...

How to handle multiple Durable Objects (with different schemas and migrations)

Is there a way to kind of have two Drizzle "projects" in one? I want to have two sets of schemas, and two of everything such that I can all one set of migrations on one Durable Object, and another on another Durable Object. This is because one worker allows for multiple Durable Objects to be defined and used...

Drizzle-kit incorrectly defaulting to @neondatabase/serverless driver

Hello, initially set up drizzle.config.ts and did a drizzle-kit generate and migrate and that worked. Now when I attempt to run a generate and migrate, the migrate fails, saying it can't open a websocket to the neon database. I am hosting pg in docker locally, my database url is such: DATABASE_URL=postgres://<user>:<password>@localhost:5432/drizzle-db ```...

Security issue GHSA-67mh-4wv8-2f99

Trying to bring attention to the security advisory listed below which is currently applicable to Drizzle-Kit, though a member of the Drizzle team has yet to respond. The issue is present since October of last year. The security advisory in question: https://github.com/advisories/GHSA-67mh-4wv8-2f99 ...

Drizzle alongside Electron, Vite and Nuxt

Hey! Recently decided to go for Drizzle on my Manga reading app I'm making with electron and nuxtjs (vue framework). However when I compile my code through vite, nuxt-electron and vite-plugin-electron, I get this fatal error: (other message since discord's limit..) ...

Generated Column Unique Constraint

The Drizzle docs on generated columns (https://orm.drizzle.team/docs/generated-columns), for Postgres, say "Cannot directly use in primary keys, foreign keys, or unique constraints" Does this mean that generated columns cannot have unique constraints generated in the SQL? The postgres docs (https://www.postgresql.org/docs/current/ddl-generated-columns.html) are linked, but I don't see any mention about unique constraints being unsupported there. Is this then a limitation of Drizzle, or is it a Postgres limitation after all?...

drizzle-kit push Cloudflare d1 local

How can I develop locally with drizzle and a Cloudflare d1 database. I would preferably want to use drizzle-kit push.

Type Error when Generating Typebox

I'm encountering a type compatibility issue with Drizzle ORM and TypeBox. When using createSchemaFactory from drizzle-typebox with PostgreSQL tables, I'm getting type errors when trying to create schemas. But in Runtime it Works without any Problems, i also Tried to edit my tsconfig to: ```json { "compilerOptions": {...