Does introspect only generate schema in the "out" (./drizzle) directory?
My config looks like this:
But if I run introspect, it always generates in ./drizzle
Am I doing something wrong or is this expected?
6 Replies
it's always been that way for me, I have a package script to generate the schema and copy it to the target
change to:
Wouldn't that also put all the migrations there? I only want the schema
well you can just change it to './src/lib/server/db' it will overwrite your exisitng schema and relatiopn file tho, which is prob not what you want
but if you want to keep all your migrations seperate and only diff for introspect then you can either use a seperate config file and specify on cli using introspect --config=intro.config.ts or using introspect --out=src/lib/server/db/
I think I'm overengineering it at this point 😄 I don't need to introspect that often so I'll just manually move them
Thank you both though!
here's my commands, fyi
"drizzle-kit introspect && npm run postprocess-pulled-schema && mv drizzle/schema.ts src/lib/db/schema.ts",
(in a package.json script)
postprocess-pulled-schema
is an intermediate step I put in that runs sed
over the output to change some things - e.g. introspect always pulls timestamp columns in 'string' mode, so I have "shx sed -i \"s/mode: 'string'/mode: 'date'/\" drizzle/schema.ts",
to fix those
I recommend setting that sort of thing up since it's relatively easy to do and have it be consistent