supabase-community / supabase-ex

A complete Toolkit to interact with Supabase APIs from Elixir
https://hexdocs.pm/supabase_potion
MIT License
121 stars 3 forks source link

[PostgREST] Integrate with Ecto #4

Open zoedsoupe opened 1 year ago

zoedsoupe commented 1 year ago

Users can already use the direct connection with their Postgresql instance on Supabase, however, an additional PoC feature could be to implement an Ecto.Adapter for PostgREST.

Also, we possibly could generate schemas/relations/migrations and also some basic CRUD functions based on the schema of the database instance of supabase.

Finally, maybe would be interestig to implement DSL that is independent from ecto to interact directly with PostgREST

Piorities:

  1. generate ecto schemas based on supabase database schema
  2. create an Ecto.Adapter (?)
  3. implement DSL (?)

(?) - only a PoC for now

chasers commented 6 months ago

It's going to be slower for an Elixir app to go through PostgREST all the time vs a native Postgres connection.

chasers commented 6 months ago

It would be v nice to have the RLS context set for you on all Ecto queries tho.

This way if you use a Supabase HTTP API or direct connections via Ecto you can ensure users always only see the data they should see based on your RLS policies.