Writing Typesafe sql?

Advice for writing typesafe sql with some linter or something? I'm using supabase for a while now, and the only thing i don't like is writing sql without any type hint or autocomplete, there are some way of getting this right? vscode extensions or something?
4 Replies
Brendonovich
Brendonovich3y ago
I'd check out one of these: - Kysely, a typesafe query builder https://github.com/koskimas/kysely - ts-sql-plugin, typescript completion directly for your sql queries https://github.com/xialvjun/ts-sql-plugin
fotoflo
fotoflo3y ago
isnt that what prisma is for?
oljimenez
oljimenezOP3y ago
Prisma is an ORM, and like most ORMs give u the minimun of sql that u need for query something. But query is not my problem, i need to do advanced sql things like Triggers, Functions and Policies, because that's how Supabase works.
Igal
Igal3y ago
Kysely doesn't support these. Here's an issue from a while back about triggers https://github.com/koskimas/kysely/issues/84
Want results from more Discord servers?
Add your server