In Supabase, is it possible to create a Row in ano...
# off-topic
a
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
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
Oops sorry
@User
Sorry but what in the world is a trigger?
a
Doesnt a trigger just create a brand new table? I want to just insert a row
s
No, a trigger doesn't create a brand new table
a
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
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
@User Wait so does this trigger which listens to change call a function, and this function must use raw SQL queries?
s
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
But those use actual SQL queries?
Areant I just using Supabase?
s
Supabase is based on Postgres. Postgres uses SQL. Triggers are written in SQL.
a
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