How to insert, store, retrieve data in Supabase (or other databases) in more tables?

Hello Everyone,

I’m struggling with this issue for quite some time now.

What I understood so far? To store data that is information that I want to retrieve as it is (persons, orders, items table) it is good to store them normally in tables. To store data that I want to retrieve using AI agent, it is better to store data in vector stores, as it is consumed by agent after retrieval and the LLM is creating answer based on that.

I am trying to create an ordering and tracking bot. The task is that I want to store orders and items in a database. Normally we store orders and items in two different tables, and we store the orders made by clients in a different, third table (junction table, many-to-many relationships) where every order has the items that belongs to them (maybe in this scenario the items table and the orders junction table would be enough and it’s just me overcomplicating it.). I can’t figure it out how to create it effectively.

How can I create a workflow that a client asks through email, Telegram or other channel for order details and it will answer with the right details and items? How can I take it further and make it able to take order from clients too? And then how can I implement to only answer the order that belongs to that client?

This is how far I’ve got in the workflow:

And the Supabase database I created: