Drizzle Team

DT

Drizzle Team

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

Join

create a generateFIlterFunction

Error: ``` 3:23:36 PM [vite] page reload src/main/services/generateFilters.ts (x8) TypeError: Converting circular structure to JSON --> starting at object with constructor 'SQLiteTable'...

Typing issue - findFirst/findMany `with` parameter with a dynamic value

I am having an issue using findFirst and findMany where including a dynamic value for the with parameter breaks the types for the output. Here's a simplified example of what I have going on: ```export const findWorkById = async (id: number, scope: "basic" | "extended") => { const work = await db.query.works.findFirst({...

pgvector returning less than it should

```ts export const querySimilarTechnologies = async ( inputSkill: string, topK: number = 10000, ) => {...

drizzle kit conflict _journal.json

check the screenshot i have created 30,31 migration my team mate created 30 migration. now how to resolve this conflict
No description

View No $inferSelect

Hi folks, what is the best way to get a type from my view? It tells me I cannot do $inferSelect on a view.

PostgresError: password authentication failed for user.

I am getting error while trying to insert a new user to the DB.

Types error with where filter

I am getting an type error everytime I try an .where filter: It says the string I am passing isn't assignable to the column's definition. Any help?
No description

Advice for pooling DB connections with serverless

I have a great, working web application which uses SvelteKit, DrizzleORM, a PostgreSQL database running on Amazon RDS. It is hosted on Netlify, which means that the “backend” consists of one big serverless function (sveltekit-render) which handles all the SSR stuff that SvelteKit provides but also, crucially, makes a bunch of queries to the PostgreSQL database. I have a sort of custom-built HTTP REST API which is part of the same SvelteKit application. I don’t have to worry about huge traffic volumes, but when we got a few hundred people to connect at once, the whole thing came crashing down because the DB hit its connection limit almost immediately (100+ connections). I think that the issue is that Netlify spins up as many instances of the “sveltekit-render” function as it thinks is necessary - great for initial responsiveness of the site, but a nightmare for proliferating hundreds of simultaneous DB connections! Enabling the pooling feature provided by Drizzle (via postgres-nodejs) doesn’t really help much, because the instances of the “server” process don’t persist long enough to take much advantage of pooling, and in any case there isn’t any really anything to “share” between the instances anyway. At least, this is my understanding of the root cause....

Drizzle Studio breaking with PGlite + PGVector

Getting a message Error: could not access file "$libdir/vector": No such file or directory I am able to generate and run migrations using drizzle-ORM and insert, query data correctly. It just fails when i try to load studio, i wanted to see the data etc. Any help is greatly appreciated, i also made an issue on github 🙏 ...
No description

Drizzle types error

Hello, I have this schema: ```typescript export const applications = pgTable('applications', { id: uuid('id').primaryKey().defaultRandom(),...

Can you get types for results of relational queries?

You can use $inferSelect on the table to get a basic type for the table with all of its columns, but what if you're using a relational query to load some relations and limiting some columns. How do I get the type of the result here?

Help creating a localhost drizzle studio environment

I want my friend to be able to access the local drizzle studio environment on his computer Running this command: pnpm drizzle-kit studio --host 127.0.0.1 --port 3030 ...

Don't understand many-to-many relationships

I have a database setup where a project can have multiple members and members can belong to many projects. A many-to-many relationship. I've created a join table UserToProject which has one-to-many relationship with the said tables. The thing is for some reason it does not work and I get an error: There is not enough information to infer relation "__public__.Project.userToProject"...

Subqueries in insert statements

I have the following schema (in sqlite) ```sql CREATE TABLE languages (...

Importing existing db

What do you do after running npx drizzle-kit introspect?
No description

MySQL Spatial Data Schema

Does anyone know how to set up a point type in a MySQL schema? I want to take advantage of spatial indexes and spatial helper functions. Currently, I am using latitude and longitude coordinates and doing some funky sin and cosine math to get all entities in a radius...

When I store a numeric string in a jsonb col (e.g. "10.4") and select, it gets parsed into a number.

Not sure why this happens, when I use node-postgres directly this does not happen!

Drizzle Studio incompatibility with generatedAlwaysAsIdentity

Basically, https://discord.com/channels/1043890932593987624/1124768693549797416/1279077540266250334 If I define my primary key with .generatedAlwaysAsIdentity(), it seems like I can't add any records in Drizzle Studio because it tries to set the value of the column. This results in an error: cannot insert a non-DEFAULT value into column "id" But I'm 0 days old when it comes to Drizzle, so maybe I'm missing something?...

Type error in 0.33.0

``` export const cities = pgTable("cities", { id: serial("id").primaryKey(), name: varchar("name", { length: 256 }), });...

Types aren't being inferred properly

I have the following schema. ```ts export const taskFolders = pgTable('task_folders', { id: uuid('id').primaryKey().defaultRandom(), taskId: uuid('taskId').references(() => tasks.id, { onDelete: 'cascade' }),...