-
I have three tables
Each itinerary can have multiple images and those images could be linked to other resources as well. Is it possible to save the many-to-many relation via insert of bookings_itinerary? I was only able to achieve this by waiting for the insert of Is there a shortcut? If I add the image ids as an array to the bookings_itinerary object, I just receive errors that the column does not exist. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Sadly, not as far as I know. You'd have to write a database function that you could call with your inputs, and have that do the inserts and all in a transaction, otherwise you have to do multiple Supabase calls using the results of previous calls. It's unfortunate and not very performant since it creates a waterfall like profile, but it's the way it is. Writing functions isn't that bad though, and you can even use JavaScript if you enable the v8 extension. Calling them using the Supabase client is also very easy. |
Beta Was this translation helpful? Give feedback.
Sadly, not as far as I know. You'd have to write a database function that you could call with your inputs, and have that do the inserts and all in a transaction, otherwise you have to do multiple Supabase calls using the results of previous calls. It's unfortunate and not very performant since it creates a waterfall like profile, but it's the way it is.
Writing functions isn't that bad though, and you can even use JavaScript if you enable the v8 extension. Calling them using the Supabase client is also very easy.