fdarian / prisma-generator-drizzle

A Prisma generator for generating Drizzle schema with ease
90 stars 10 forks source link

Provide default export for all schema #19

Closed fdarian closed 5 months ago

fdarian commented 5 months ago

Using schema.ts for drizzle-kit doesn't expose any schema.

export default defineConfig({
  schema: './drizzle/schema/schema.ts',
})

It can't find any tables from the schema.ts, but glob works fine

export default defineConfig({
  schema: './drizzle/schema/*',
})

Originally posted by @hilja in https://github.com/farreldarian/prisma-generator-drizzle/issues/18#issuecomment-1890462189

fdarian commented 5 months ago

After some thinking, it might be better to just recommend the use of glob pattern instead of introducing another index.ts that re-exports all schema since it'll make IDE to give duplicate recommendations when importing a table. Also barrel file is normally better to be avoided because of (IDE) performance issue

hilja commented 5 months ago

That's great, mentioning it in the docs basically solves the issue. Thank for all the work!