# Database Schema Design & Tools Discussion
## 1. Concern
- Alexandre has a concern:
> once we choose our DB type, they’re may not be a reverse on that choice later.
- We have many M:N relationships in our database
E.x:
1. User <=> Company
2. User <=> Role
3. Company <=> Application
...
---
## 2. Output of this meeting
### Let's finalize the choice of Database
After this meeting, we should have the last decision for the question: "Which database we will use?" (at least in the MVP version)
... So we can start working on the code
---
## 3. Current Choices
1. RDBMS (PostgreSQL, Mysql, ...)
2. NoSQL (MongoDB, ScyllaDB, ...)
Michael Bailly stated:
> This is the rule with NoSQL datastore: you have super fast, easy to scale, replicate, stores, and it’s up to your applcation code to handle the relationships.
---
## 4. Draft Version
In the draft version, I (Hoang) target MongoDB for our 1st MVP version:
https://ci.linagora.com/linagora/lgs/saas/portal/specifications/-/wikis/design/database
#### My personal opinion:
- NoSQL is better for building MVP. We don't have fixed schemas so we can add/update/remove fields/collections anytime as our business decision changes (which will be a lot, you'll see)
- Team familiar tech stack:
- Tuan Le has great understanding about MongoDB. He had worked with MongoDB in ESN for 4 years
- I (Hoang) am not that kind of expert, but in recent years, I worked with NoSQL (MongoDB, Firestore) most of the time
#### Notes:
About the permission to call API between server and server (e.x Twake to call SaaS API), normally, we need to use `service account`: https://developers.google.com/identity/protocols/oauth2/service-account
But for the MVP version, we can just use an API key for simplicity.
If we decide to use `service account` after the MVP 1st version is out, we might need to add more collections to this schema (I don't imagine it yet)
---
## 5. Time for Alexandre to present his draft
Alexandre:
> Hello everyone,I've made on my side a draft (to have an other view of what can be useful to have from my point of view) of the database important keys.
Since we're working asynchronously, with whom can I discuss about what I have? Can we have like a quick meeting (20-30 minutes top I think to discuss it?) Having a live discussion will be better than having to talk in a thread with the delay
> it's something not to take lightly, and I think, once we choose our DB type, they're may not be a reverse on that choice later.
---
## 6. Discussion