-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
Shawn edited this page May 12, 2019
·
4 revisions
| Column Name | Date Type | Content |
|---|---|---|
id |
integer | primary key, auto increment |
username |
string | not null |
first_name |
string | |
password_digest |
string | not null |
session_token |
string | not null |
- index: username, unique
const UserSchema = new Schema({
username: {
type: String,
required: true
},
first_name: {
type: String,
required: true
},
children: {
type: Array,
required: true
},
password_digest: {
type: String,
required: true
},
date: {
type: Date,
default: Date.now
}
})| Column Name | Date Type | Content |
|---|---|---|
id |
integer | primary key, auto increment |
title |
string | not null |
body |
text | not null |
amount |
float | not null |
deadline |
date | |
parent_id |
integer | not null |
child_id |
integer | |
repeating |
string | default: one-time |
priority |
boolean | default: false |
- index: child_id, parent_id
- Foreign Key:
child_idbelongs to users - Foreign Key:
parent_idbelongs to users
const ChoreSchema = new Schema({
title: {
type: String,
required: true
},
body: {
type: String,
required: true
},
amount: {
type: Numbers,
required: true
},
deadline: {
type: Date
},
parent: {
type: Schema.Types.ObjectId
ref: 'users'
},
child: {
type: Schema.Types.ObjectId
ref: 'users'
},
repeating: {
type: String,
default: "one-time"
},
priority: {
type: Boolean,
default: false
}
date: {
type: Date,
default: Date.now
}
})| Column Name | Date Type | Content |
|---|---|---|
id |
integer | primary key, auto increment |
parent_id |
integer | not null |
child_id |
string | not null |
balance_owed |
float | not null |
- index: parent_id, child_id
- Foreign Key:
parent_idbelongs to users - Foreign Key:
child_idbelongs to users
Not needed
| Column Name | Date Type | Content |
|---|---|---|
id |
integer | primary key, auto increment |
child_id |
integer | not null |
amount |
float | not null |
- index: child_id
- Foreign Key:
child_idbelongs to users
const PayoutSchema = new Schema({
parent: {
type: Schema.Types.ObjectId,
required: true
},
child: {
type: Schema.Types.ObjectId,
required: true
},
amount: {
type: Numbers,
required: true
},
date: {
type: Date,
default: Date.now
}Team: Shawn Scott, Grant Paulson, Sean Kennealy, Vu Tran