Wednesday, 7 June 2017

Database design for kids chore schema

I'm wondering about best practise to keep a database as tidy as possible. The database is postgresql accessed by express.js/node. It is for a kids chores app that I'm working on and it has the following schema:

CHILDREN
    id
    name
    points
    rate
    created_at
    updated_at
    user_id

TASKS
    id
    description
    value
    days (boolean array - eg. [0,0,0,0,0,0,0])
    periods (boolean array - eg. [0,0])
    created_at
    updated_at
    user_id

FINISHED TASKS
    id
    task_id
    child_id
    completed (boolean)
    created_at
    updated_at
    period (boolean)
    day (int (0-6))

For every individual finished task a row is created in the database. With only 400 children doing chores in there, there are already around 800 rows being added each day to the FINISHED TASKS table. I have two questions:

1) Is there a more efficient way of storing FINISHED TASKS either for a full day per child or similar? 2) With scale I'm going to end up with potentially tens of thousands of rows per day - is this acceptable for an app like this?



via Ezra

No comments:

Post a Comment