Store multiples databases with the same name #73
-
Good afternoon. In this moment, I have an app that works in many devices, computers, and each one have her own database, to register information about a process. I want to sync this databases with cloud, but, I want to keep each database separated, so that each client can consult the information only for their device. Is this possible, and if so, how can I do it? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @ingdesarr1 , Thanks for reaching out. What you're describing is a perfect use case for OffSync in combination with Row-Level Security (RLS) and Access Tokens. These features are designed specifically to support secure, multi-device, and multi-tenant architectures—while maintaining clear data separation between clients. ✅ Recommended ApproachInstead of managing a separate database per device, we suggest using a single shared database with an additional column to track ownership. For example: CREATE TABLE tasks (
id TEXT PRIMARY KEY NOT NULL,
user_id TEXT,
title TEXT,
status TEXT
); With this setup:
🔐 Example RLS PoliciesHere’s how you could define policies to enforce per-user data access:
⚙️ Why This MattersThis approach scales far better than managing multiple databases or tables—especially as your user base grows. With a single table and secure row-level access, your app logic becomes much simpler and more maintainable. Let me know if you’d like guidance setting up OffSync or configuring RLS for your use case. Best regards, |
Beta Was this translation helpful? Give feedback.
-
I can say that if the number of client's databases/installations is limited, you can sync each client's local database to a dedicated database on the cloud. In this way you can keep a backup of the client's users data and interact with those data from the cloud database. With this solution you have isolated databases (as they are locally) and you don't need to implement Row Level Security policies. |
Beta Was this translation helpful? Give feedback.
Hi @ingdesarr1 ,
Thanks for reaching out.
What you're describing is a perfect use case for OffSync in combination with Row-Level Security (RLS) and Access Tokens. These features are designed specifically to support secure, multi-device, and multi-tenant architectures—while maintaining clear data separation between clients.
✅ Recommended Approach
Instead of managing a separate database per device, we suggest using a single shared database with an additional column to track ownership. For example:
With this setup: