Skip to content

Database Schema

Kimi-Zou edited this page Dec 1, 2020 · 4 revisions

Schema for PostgresQL using Sequelize ORM

Users

column name data type details
id integer not null, primary key
userName string(255) not null, unique
email string(255) not null, unique
hashedPassword string not null
points integer not null, default 0
createdAt datetime not null
updatedAt datetime not null
  • unique on username
  • unique on email
  • Sequelize hasMany Rewards association
  • Sequelize hasMany Lists association

Rewards

column name data type details
id integer not null, primary key
rewardName string(255) not null
rewardDescription text
rewardValue integer not null
isCollected boolean not null, default false
userId integer not null, foreign key
createdAt datetime not null
updatedAt datetime not null
  • userId references Users table
  • Sequelize belongsTo Users association

Lists

column name data type details
id integer not null, primary key
listName string(255) not null
userId integer not null, foreign key
createdAt datetime not null
updatedAt datetime not null
  • userId references Users table
  • Sequelize hasMany Chores association
  • Sequelize belongsTo Users association

ChoreTypes

column name data type details
id integer not null, primary key
choreType string(255) not null
createdAt datetime not null
updatedAt datetime not null
  • Sequelize hasMany Chores association

Chores

column name data type details
id integer not null, primary key
choreName string(255) not null
value integer not null
note string(280)
dueDate date
isCompleted boolean not null, default false
listId integer not null, foreign key
choreTypeId integer not null, foreign key
createdAt datetime not null
updatedAt datetime not null
  • listId references Lists table
  • choreTypeId references ChoreTypes table
  • Sequelize belongsTo Lists association
  • Sequelize belongsTo ChoreTypes association

Clone this wiki locally