https://supabase.com/ logo
#off-topic
Title
# off-topic
a

Aghilan

03/26/2022, 3:38 AM
In Supabase, is it possible to create a Row in another Table anytime a User is created. This row would have the same ID column and has other pre-defined data
s

Scott P

03/26/2022, 3:43 AM
Yes, there are several links which explain this: https://supabase-cheatsheet.vercel.app/docs/auth/public-profiles-table#trigger-procedure https://github.com/supabase/supabase/discussions/5421 For future reference, general is not to be used for help requests.
a

Aghilan

03/26/2022, 3:43 AM
Oops sorry
@User
Sorry but what in the world is a trigger?
a

Aghilan

03/26/2022, 3:45 AM
Doesnt a trigger just create a brand new table? I want to just insert a row
s

Scott P

03/26/2022, 3:46 AM
No, a trigger doesn't create a brand new table
a

Aghilan

03/26/2022, 3:47 AM
Let's say I had a table with the following columns
The table name is Finance Tracker
id: int8, UserID: uuid, Investments: text[], Expenses: text[]
Could you show me how the trigger would look like with a newUser is created in the users table
I do not know SQL and I unfortunately do not have time to learn it as I'm on a bit of a time crunch
Oh damn Supabase makes it so easy'
I dont need to make SQL queries
Ok nvm
I don't know
s

Scott P

03/26/2022, 3:53 AM
Sorry, but I've got my own things to do. There's examples in the links which should be easy to adapt to your use case.
a

Aghilan

03/26/2022, 3:53 AM
@User Wait so does this trigger which listens to change call a function, and this function must use raw SQL queries?
s

Scott P

03/26/2022, 3:54 AM
I'd suggest reading the link I posted above. It explains what triggers are, how to write them, things to watch out for, etc.
a

Aghilan

03/26/2022, 3:55 AM
But those use actual SQL queries?
Areant I just using Supabase?
s

Scott P

03/26/2022, 3:55 AM
Supabase is based on Postgres. Postgres uses SQL. Triggers are written in SQL.
a

Aghilan

03/26/2022, 3:55 AM
Actually there is a vid from Supabsse online
Hopefully it explaisn it because I didnt really understand the docs
Ok I watched a video on setting up triggers in Supabase but it isnt working. Job for tmr