Skip to content

Database Schema

Timothy Wieser edited this page May 28, 2021 · 6 revisions

Users

Column name Data type Details
id integer not null, primary key
user_name varchar(50) not null, unique
email varchar(50) not null, unique
first_name varchar(50) not null
last_name varchar(50) not null
hashed password varchar(50) not null
created_at datetime not null
updated_at datetime not null


Questions

Column name Data type Details
id integer not null, primary key
question_title varchar(200) not null
question_body varchar(max) not null
user_id integer not null
created_at datetime not null
updated_at datetime not null
  • user_id references users table


Question_likes

Column name Data type Details
user_id integer not null
question_id integer not null, unique
question_votes Boolean not null
created_at datetime not null
updated_at datetime not null
  • user_id references users table
  • question_id references questions table


Answers

Column name Data type Details
id integer not null, primary key
answer_body varchar(max) not null
user_id integer not null
question_id integer not null
created_at datetime not null
updated_at datetime not null
  • user_id references users table
  • question_id references questions table


Answers_likes

Column name Data type Details
user_id integer not null
answer_id integer not null, unique
answer_votes Boolean not null
created_at datetime not null
updated_at datetime not null
  • user_id references users table
  • answer_id references answer table
Clone this wiki locally