Skip to content

Database Structure

Robert Fraser edited this page Jul 5, 2019 · 2 revisions

User

The user table stores the basic user identification settings such as username and password.

Column Type Description
uid Int Auto-incremented unique ID for the user
username Text Username for login
password Text Salted hash for passwords

Activities

The activities table keeps track of what activities users can claim, as well as how many 'points' each action is worth.

Column Type Description
id Int Auto-incremented unique ID for each activity
name Text Name of the activity (localized in-app)
points Int How many 'points' this activity is worth

Articles

Stores information about the articles that may appear in user feeds. These are essentially external links to other pages, which can be added at various dates. The same article may be added to the system at multiple different dates.

Column Type Description
id Int Auto-incremented unique ID for each entry
title Text Title of the article
description Text Brief description of the article
url Text Linking URL of the article
date Datetime Date & time when the article was added to the feed

Flowers

Keeps track of what flowers users can purchase to add into their garden.

Column Type Description
id Int Auto-incremented unique ID for each flower
name Text Pretty name of the flower
price Int How much the flower costs to purchase
instore Bool Whether or not the flower is currently in store

Friends

Keeps track of a friendship. This should be stored as a two-way relationship (eg. A is friends with B and B is friends with A)

Column Type Description
user1 Int UserID of the first user in the friendship
user2 Int UserID of the second user in the friendship

Garden

Users plant various flowers in their garden. This table keeps track of what flowers are planted & when they were planted in the garden.

Column Type Description
uid Int UserID of the garden owner
flower Int ID of the flower planted
planted Datetime When the flower was planted

Goals

Needs refinement. Goals are less frequent activities that users can perform.

Column Type Description
uid Int UserID of the goal setter
description Text Brief description as to what the goal is
completion Date When the goal was completed

Liked Articles

Users can like an article. This table keeps track of what articles various users like.

Column Type Description
uid Int UserID of who liked the article
article Int ID of the article that was liked

Settings

Some privacy settings need to be stored in the cloud - this table keeps track of these settings.

Column Type Description
uid Int UserID
setting Text Name of the setting
state Bool Whether the setting is enabled or disabled

User Activities

An important table that stores what activities a user has performed on a given day. Each activity is performed X number of times in a given day (eg. 100 steps, 100km travelled by public transport, 10 trees planted).

Column Type Description
uid Int UserID of who performed the activity
activity Int ID of the activity
amount Int How many times the activity was performed on the given date
date Date What date this action was performed on

Clone this wiki locally