How to integrate Drizzle into Supabase project

Hey there, we're using Supabase for our project an unfortunately, it doesnt support transactional logic using their DB client. We are looking for an ORM that is easy to integrate to the existing Supabase-managed schema so we can run transactions using TS from our edge functions. How easy is it to setup Drizzle with an existing schema? Im managing migrations myself so Im more interested in getting all the good TS intellisense and typing directly in our Deno functions without having to now manage 2 DB libraries. Are there guides on how to do this?
3 Replies
bombillazo
bombillazoOP2y ago
I saw some guides from both Supabase and Drizzle but I required us to now create a schema file, I am trying to avoid this and have the Supabase migrations be the source of truth to the schema definition.
3b00d
3b00d2y ago
you can try
drizzle-kit introspect:pg
drizzle-kit introspect:pg
https://orm.drizzle.team/kit-docs/commands#introspect--pull this will generate a schema file pulled from your database
bombillazo
bombillazoOP2y ago
Ok,thanks! Reading more on it, seems like the approach is to use Drizzle itself to create the migrations, but Im not sure how deep/broad their migration logic goes since we track changes for various schemas, changes in RPC functions and RLS policies...
Want results from more Discord servers?
Add your server