Closed Scalahansolo closed 5 months ago
There's currently schema.ts
that exports a schema
variable which you can use to get all models from one entrypoint. It's also used for relational query
Yeah, I've been using that. It just feels overly verbose to always have to do prepend my models with schema.XXX
but maybe that's just me.
Im guessing I can probably figure something how for myself for now. If down the line this continues to be something I want to improve I'll throw out a PR.
I personally just use import { users } from ".../users"
, which is what I would also do if I wrote the schema by myself. I only use the import { schema } from ".../schema"
when I initialize drizzle to setup the relational query.
I am trying to create an internal package in my codebase that needs access to everything in my schema. Right now all the models are imported to build the schema, but I need access to those types outside of that one file and I don't want to have to seek into the individual files.
Maybe the generated directory should include an
index.ts
which exports out theschema
as well as all the individual models?