Is there a way to configure pg introspect to generate date rather than string inference columns?
My workflow involves writing migrations by hand outside of drizzle and using schema introspection to pull in changes. This works well except for date columns, which are always generated as
mode: 'string'
by default.9 Replies
Hello, @francis! It is impossible to configure pg introspect in your workflow to generate date columns with a specific mode other than the default string mode. Because
mode
option is not directly related to SQL but is a feature specific to Drizzle, which operates at the TypeScript level.
If you need to set a different mode, this adjustment has to be done manually. In your schema, you would specify it as date: date('date', { mode: "date" }),
that's unfortunate. this adjustment would be overwritten every time we pull, correct?
we are using supabase with extensions and using the supabase migration system to deploy them. I suppose we could use drizzle to generate migrations and then modify the generated sql by hand to add row level security commands, etc?
Do you work on a linux or mac?
How do you run the introspect?
I could use a postprocess step to convert them, yeah, but that's a code/process smell to me
I think the actual solution here is to embrace drizzle, generate migrations with drizzle, then edit them to add supabase extra stuff when ready to deploy
so I'm not pulling with introspect on every single schema change
I'd suggest you add a line to your scripts in package.json:
yeeeeeeah I was thinking of that. but I'd rather not
Might need some adjustoments
I should probably just update my workflow. thanks!
It's just workarounds, you might want to submit a feature request in GH
I was working on getting RLS in drizzle, so that's a plus
I should finish that pr this weekend