JJZFIVE
JJZFIVE
DTDrizzle Team
Created by JJZFIVE on 5/26/2024 in #help
How to put Drizzle schemas in shared folder (monorepo) and have api's drizzle.config recognize them
P.P.S - does it make sense for me to pull the Drizzle tables into the shared folder? Or is there a better way to set this up - again, I need both frontend and backend to see the types in production (frontend and backend are deployed to separate servers), and I'm inferring the TS types like this per the docs:
export type ISqlPostComment = typeof postComment.$inferSelect
export type ISqlPostCommentNew = typeof postComment.$inferInsert // insert type
export type ISqlPostComment = typeof postComment.$inferSelect
export type ISqlPostCommentNew = typeof postComment.$inferInsert // insert type
And here's my Drizzle.config.ts which is in the root of my backend folder:
import type { Config } from 'drizzle-kit'

// TODO: how to point to schemas from the shared folder?
export default {
schema: 'src/schemas/db/drizzle/*',
out: './drizzle'
} satisfies Config
import type { Config } from 'drizzle-kit'

// TODO: how to point to schemas from the shared folder?
export default {
schema: 'src/schemas/db/drizzle/*',
out: './drizzle'
} satisfies Config
5 replies