Database Schema - John-Amini/AppOverflow GitHub Wiki
Users
| Column name |
datatype |
details |
| id |
integer |
not null,primary key |
| username |
varchar |
not null,unique |
| email |
varchar |
not null, unique |
| hashed_password |
varchar |
not null |
| created_at |
timestamp |
not null |
| updated_at |
timestamp |
not null |
username, unique: true
email, unique: true
Questions
| Column name |
datatype |
details |
| id |
int |
primary key not null |
| title |
varchar |
not null, unique |
| content |
text |
not null |
| created_at |
timestamp |
not null |
| user_id |
int |
not null, foreign key |
| updated_at |
timestamp |
not null |
title, unique:true
user_id references Users table
Answers
| Column name |
datatype |
details |
| id |
int |
primary key not null |
| content |
text |
not null |
| question_id |
int |
foreign key not null |
| user_id |
int |
foreign key not null |
question_id references Questions table
user_id references Users table
Votes
| Column name |
datatype |
details |
| id |
int |
primary key not null |
| answer_id |
int |
foreign key not null |
| user_id |
int |
foreign key not null |
| vote |
boolean |
not null |
answer_id references Answers table
user_id references Users table
Comments
| Column name |
datatype |
details |
| id |
int |
primary key not null |
| answer_id |
int |
foreign key not null |
| user_id |
int |
foreign key not null |
| content |
text |
not null |
answer_id references Answers table
user_id references Users table