Skip to content

Add transaction support for Supabase API #1190

Open
@CaLouro

Description

@CaLouro

Is your feature request related to a problem? Please describe.
I have the need for writing (inserting, updating, deleting) on more than one table in the database, but with the current package API I cannot do those actions inside a single atomic request.

Describe the solution you'd like
I'd love one of the two solutions that I think would benefit Supabase (or both, why not?):

  1. Create a Supabase Client method that allows me to bundle other method calls inside a single transaction that is guaranteed to run atomically and returns only a single error on failure;
  2. Create a Supabase Client method that allows sending a raw (or formatted) query to the database using the current logged in user's permissions (RLS, for example).

Describe alternatives you've considered
I've considered using Edge Functions or Stored Procedures for this but in my case:

  1. I'm not super versed in JS for the Edge Functions and I would have liked to keep this logic on device;
  2. Stored Procedures can be hard to write for methods with many parameters (objects along side lists in my case).

Additional context
I'd appreciate the consideration and help.

If there are any other methods for achieving the same result please let me know.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions