Database Schema - vernfongchao/Catoura GitHub Wiki
Data Model

Cats
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| firstName | string | not null |
| lastName | string | not null |
| username | string | unique, not null, maxLength:20 |
| string | unique, not null | |
| hashedPassword | string | not null |
| favFood | string | not null |
| created_at | timestamp | not null |
Questions
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| title | string | not null |
| content | string | not null |
| user_id | int | ref: > cats.id |
| created_at | timestamp | not null |
Answers
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| content | string | not null |
| user_id | int | ref: > cats.id |
| questions_id | int | ref: > questions.id not null |
Topics
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| title | string | unique, not null |
| user_id | int | ref: > cats.id |
Question_Topics
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| question_id | int | ref: > questions.id not null |
| topic_id | int | ref: > topics.id |
Comments
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| user_id | int | ref: > cats.id not null |
| answer_id | int | ref: > answers.id |
Replies
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| content | string | not null |
| user_id | int | ref: > cats.id |
| comment_id | int | ref: > comments.id |
Question_Upvotes
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| user_id | int | ref: > cats_id not null |
| question_id | int | ref: > questions.id |
Question_Downvotes
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| user_id | int | ref: > cats.id not null |
| question_id | int | ref: > questions.id |
Answer_Upvotes
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| user_id | int | ref: > cats.id not null |
| answer_id | int | ref: > answers.id |
Answer_Downvotes
| column name | data type | details |
|---|---|---|
| id | integer | pk, increment, not null |
| user_id | int | ref: > cats.id not null |
| answer_id | int | ref: > answers.id |