Communication between databases
I have two mobile apps that I want to create. One is a staff-focused mobile app for users to upload photos and tags on those photos (think instagram). These staff users are essentially creating a home page for their business so that their customers can interact with these photos and tags.
The customer users will have their own app where they can find the home page created by the staff, open the photos, and interact with the tags uploaded by staff.
I want to have two databases communicating with eachother. Once where the staff profiles are saved, and the images and tags are saved. The other database will save customer profiles, and the interactions with the images and tags.
In order for the customers to be able to save their interactions, they need to be able to see the images and tags from the staff database. In order for the staff to gather functional data and aggregated analytics about the customer interactions with the tags, their database needs to grab all of that info.
How can I set up both databases to smoothly and swiftly exchange information like that via API?
3 Replies
Are they both postgres databases? If so then you could use Foreign Data Wrappers to allow access to each some of each other's tables as tables in the other database.
Do you need to separate databases or can you use schemas or RLS in a single database to get your separation?
Im open to the best suggestion for this use case. I believe this is postgres, but not tech savvy enough to know.
Supabase is Postgres.
I really can't answer your question as it is up to you.
If you are just starting to use databases then it will certainly be easier to create two types of users with a role claim or table in one database and use RLS to separate what they can do and see (or be allowed to see).
You mentioned two database like you already have some need for that for your apps.
Supabase has nothing specific to enable or prevent either method or possibly others.
Maybe some research with an AI might be useful.
Or another user might come along.