DT
Drizzle Team
Join the Drizzle Team server to ask questions!
Join ServerDT
Drizzle Team
Join the community to ask questions about Drizzle Team and get answers from other members.
Join ServerChannels
Node app Typescrip drizzle-orm/libsql works fine in terminal, but errors running in Docker container
I've built a Node Express app with Typescript. I'm using Drizzle and TursoDb for the data stuff. Everything works peachy when I'm running the app in terminal. It also builds (tsc) and then the /dist version runs perfectly great.
However, when I build a Docker container and the app tries to run, I get an error on the drizzle-orm/libsql line in transpiled JS...
```js...
Drizzle Relations
Can any one help me to do this?
like, we have a tweets so, each tweets have parent id/uuid, and author id/uuid.
normally as we can see a tweet have lot's of children as children tweet which is belong on parent tweet.
so, please help me make this with pg-core....
Creating triggers with SQLite
How is everyone handling trigger statements at the moment? I've tried adding something like:
``sql
CREATE TRIGGER new_user AFTER INSERT ON users BEGIN
INSERT INTO user_org (user_id, org_id`) VALUES (NEW.id, last_insert_rowid ());
END;...How do I get insertId from table using cuid2
I want to insert data using a relations, but mysql doesn't support returning(). so i was using insertId, but it doesn't work with custom id like cuid. What should i do
help with drizzle-zod with jsonb column
I have this table definition:
```
interface Address {
street: string...

Using "which" to check an alias isn't working.
```ts
// missing FROM-clause entry for table "notSubcategory"
search?.categoryId ? eq(notSubcategoryTable.categoryId, search.categoryId) : undefined,
// works fine
search?.subcategoryId...
Stuck loading
Hey, I'm having this issue where the website is stuck loading.
using next.js
initialized the schema like this:
export default drizzle(new Client(process.env.DATABASE_URL!), { schema })
and just queried it from server side:...Error: There is not enough information to infer relation
Hey,
I'm trying to convert a Prisma schema to Drizzle.
Here's the schema:...
drizzle-kir studio 401
Hi guys, it's my first time with Drizzle.
I'm getting a
401 off the bat when starting drizzle-kit studio
```bash...Order of migration files
Drizzle-kit generates migration files which stay in order based on its naming pattern
<xxxx_name.sql>
Supabase, e.g. when using supabase db pull (to ensure production/local development setup is in sync) creates migration files naming them like <timestamp>_name.sql
This leaves us with a local list like:...Difference between query modes
Heyo everyone ! 👋
Is there anyway I can get same result than result1 query using result2 syntax with db.select() ?
```ts
const result1 = await db.query.notifications.findMany({
where: eq(notifications.guild_id, interaction.guildId),...
Getting TypeScript warnings where they should not be
I started using Drizzle today and I realized that TypeScript checking in IntelliJ IDEA is showing warnings where it should be ok...
It is giving me proper options and also shows an error if the type is wrong, but I cannot get rid of the warnings for some reason.
Examples:...

Drizzle ORM: Inferring Relation multiple Many to one relation
Hi everyone,
I'm working on a project using Drizzle ORM in a Next.js environment and I've run into a snag. My goal is to set up a database schema for an educational platform where courses have dependencies on other courses. Specifically, I'm trying to establish two types of relationships in my courses table:
Course Dependencies: Identifying the prerequisite courses for a given course....
drizzle infers incorrect type of decimal
I declare a column of type decimal. When inserting data, it requires a string (which makes sense as JS can't handle big number). However, when I query the column, it is returned as number while it is inferred as string by typescript.

.query.with relationship types don't work unless I manually type them out
I thought I had posted this here some time ago, but I can't find the post so I hope I'm not double posting but I'm looking for a bit of guidance.
For reference, I'm creating a bill payment tracker that can be used with multiple people through groups I call "households."
For a while, using the
db.query.households.findMany({with: { users: true }) gave me proper type inference in my editor. For reference, I have my files split up per the picture, with each table having a separate file, with all exports from those files being re-exported in the index.ts like so:...
Multi-tenancy
Hey, we are trying to implement an use-case in our project and I need help on how to do it.
We have an app that needs a environment for each user (a schema). And this schema has multiple (more than 20) tables. The authentication is made by an config schema that has a table that stores user credentials and his schema name. All user-enviroments are the same, so I need that every change that I do, will propagate to all of them.
My problem is, how can I achieve this?...
Many to many relation not enough information
```ts
export const orderRelations = relations(orders, ({ many, one }) => ({
stripeTransactions: many(stripeTransactions),
}));
...
