Andadurias / Instant-Notes

Micro journaling app to reduce the effort of taking notes, managing memories and connecting ideas
The Unlicense
2 stars 1 forks source link

Information structure and database implementation #8

Closed BlancaCC closed 1 year ago

BlancaCC commented 2 years ago

In order to solve #7 we need to structure information, in this first iteration:

The information is structured by:

What would be the more suitable database option?

BlancaCC commented 2 years ago

In order to choose the database I have search many pages:

The circumstances we need to have in mind are:

  1. Integration: A priori we do not have any special requirements. (We have freedom in this sense)
  2. Scaling requirements: The amount of data it is suppose to be big. So we will need a database easy to escalate horizontally and ideally transaction rate or throughput.
    To satisfy this requirement son candidates are: Cassandra, MongoDB, Google Cloud Spanner, Amazon RDS (The cloud version of MySQL).
  3. Support consideration Security (If we use a NoSQL version we will need to work a bit more)
  4. CAP: Consistence, availability and partition tolerance I rather prefer availability and partition tolerance. So some of our options are: Cassandra, Riak, Couched.

Since I do not want cloud services and having in mind all the considerations, the best option is Cassandra

BlancaCC commented 2 years ago

Cassandra data modeling

To sum up, to solve an item of #7 we are going to implement Cassandra DB and for this first iteration we need to implement:

Fields

The data structure needed is:

Primary key ((id, user_id), user_id) (cluster ordered by user id)

Cassandra characteristics

Come characteristic we have had in mind:

Casandra have two keys

Sources:

BlancaCC commented 2 years ago

Have been done in this commit 6694056d6add8b968087745674789c55a704140c

BlancaCC commented 2 years ago

It is need to restructure the design since set operation are not available for queries.

Captura de Pantalla 2022-08-13 a las 17 09 09

source min 9

BlancaCC commented 2 years ago

After thinking about the new design it would be:

Cards table

Primary key ((card_id, user), user_id) (cluster ordered by user id)

The tags are words separated by ,comas Filter them by expressions

Users

BlancaCC commented 1 year ago

For a local storage inside mobile we are going to use a SQL database (SQLite).

Tables

User information

Tags

Card

Some docs

BlancaCC commented 1 year ago

This is not a minimal product at this time