Skip to content

Database Schema

Arko edited this page Feb 22, 2023 · 9 revisions

Schema for Project:

image

users

column name data type details
id int not null, primary key
username string not null
email string not null, unique
hashed_password string not null
first_name string NO
last_name string NO
created_at datetime not null
updated_at datetime nullable
------------- -------------- -----------------------

goals

column name data type details
id integer not null, primary key
user_id integer not null, foreign key
note_id integer not null, foreign key
parent_goal_id integer, foreign key nullable
child_goal_id integer, foreign key nullable
name string not null, unique
description string not null
edit_access boolean not null
difficulty string nullable
importance string nullable
completion_percent integer not null
tags string nullable
due_date datetime nullable
created_at datetime not null
updated-at datetime nullable
finished_on datetime nullable
badges db.Relationship(badges)
users db.Relationship(users)
  • user_id references users table
  • note_id references notes table
  • parent_goal_id references goals table
  • child_goal_id references goals table
  • badges references badges table
  • users references users table for people you have shared a goal with.

tasks

column name data type details
id integer not null, primary key
user_id integer not null, foreign key
note_id integer not null, foreign key
goal_id integer not null, foreign key
parent_task_id integer, foreign key nullable
name string not null
description string not null
edit_access boolean not null
difficulty string nullable
priority string nullable
completion_percent integer not null
tags string nullable
due_date datetime nullable
created_at datetime not null
updated-at datetime nullable
finished_on datetime nullable
badges db.Relationship(badges)
users db.Relationship(users)
child_tasks db.Relationship(tasks)
  • user_id references users table
  • note_id references notes table
  • goal_id references goals table
  • parent_task_id references tasks table
  • badges references badges table
  • child_tasks referennces tasks table
  • users references users table for people you have shared a goal with.

goal_notes

column name data type details
id integer not null, primary key
goal_id integer not null, foreign key
note_body string nullable
created_at datetime not null
updated-at datetime nullable
  • goal_id references goals table

task_notes

column name data type details
id integer not null, primary key
task_id integer not null, foreign key
note_body string nullable
created_at datetime not null
updated-at datetime nullable
  • task_id references tasks table

badges

column name data type details
id integer not null, primary key
user_id integer not null, foreign key
name string not null
description string not null
url string not null
created_at datetime not null
updated-at datetime nullable
  • user_id references users table

payment_infos

column name data type details
id integer not null, primary key
user_id integer not null, foreign key
address string not null
city string not null
state string not null
zip string not null
country string not null
  • user_id references users table
Clone this wiki locally