groovebucket
groovebucket
DTDrizzle Team
Created by groovebucket on 7/10/2023 in #help
Schema not ingested with drizzle-orm/node-postgres
I have a db connection for production using Vercel Postgres. It works great. I'm trying to set up a dev connection to a local Postgres instance. I have the following code:
import { drizzle as jsDrizzle } from "drizzle-orm/node-postgres";
const db = jsDrizzle(
new pkg.Pool({
connectionString: process.env.LOCAL_POSTGRES_URL,
}),
{ schema }
);
import { drizzle as jsDrizzle } from "drizzle-orm/node-postgres";
const db = jsDrizzle(
new pkg.Pool({
connectionString: process.env.LOCAL_POSTGRES_URL,
}),
{ schema }
);
But, when I run my app, I get Cannot read properties of undefined (reading 'findMany'). This immediately made me think to check that I was passing my schema into drizzle. But, alas, I found that I was already doing that. This is the same schema that I pass into my prod Vercel PG connection, and it works there. Any pointers?
1 replies
DTDrizzle Team
Created by groovebucket on 6/24/2023 in #help
many-many with
Hi. I have a schema with users, roles and user_to_roles tables. I also have a usersRelations object, created with:
export const usersRelations = relations(users, ({ one, many }) => ({
usersToRoles: many(usersToRoles),
...
export const usersRelations = relations(users, ({ one, many }) => ({
usersToRoles: many(usersToRoles),
...
Is there a way to use with in a relational query to get back a user object (or an array of user objects) with a roles property containing an array of all roles for the user?
2 replies