1. 8
    Use Postgres Functions to Implement Database Logic with Supabase
    1m 5s

Use Postgres Functions to Implement Database Logic with Supabase

InstructorJon Meyers

Share this video with your friends

Send Tweet

Each time a new user signs in, we want to create an associated profile. In PostgreSQL, we can use triggers to listen to events - such as INSERT - on specific tables - such as auth.users - and execute a Postgres function.

In this video, we use the Supabase UI to create a Postgres function that returns a trigger. This is a special kind of function that can be invoked when particular events occur in the database - covered in the next lesson. This function will be responsible for creating a new row in the profile table, using the ID from our auth.users record.

James
~ a year ago

I learned a lot by watching this. It would be really awesome if you could explain how to create a local version of this exact DB after learning how to deploy to prod. In a real world situation we'd likely have the production version, and a local version that can be ran without disrupting the production DB. Fingers crossed for that.