Database Schema - KyleHere/Flora GitHub Wiki

schema

Users

column name data type details
id integer not null, primary key
username string not null, unique
email string not null, unique
profile_pic string not null
hashedPassword string not null

Followers

column name data type details
follower_id integer not null
following_id integer not null
  • following_id references Users table

many to many relationship [user can follow many users and also have many followers]

  • follower_id references Users table

many to many relationship [user can follow many users and also have many followers]

Questions

column name data type details
id integer not null, primary key
user_id integer not null
title string not null
created_at timestamp not null
updated_at timestamp not null
  • user_id references Users table

one to many relationship [user can make many questions but a question can only be owned by one user]

Answers

column name data type details
id integer not null, primary key
user_id integer not null
question_id integer not null
answer_text string not null
created_at timestamp not null
updated_at timestamp not null
  • user_id references Users table

one to many relationship [user can make many answers but an answer can only belong to one user]

  • question_id references Questions table

one to many relationship [a question can have many answers but an answers can only belong to one question]

Likes

column name data type details
user_id integer not null
question_id integer not null
  • user_id references Users table

many to many relationship [user can make likes on many post]

  • question_id references Questions table

many to many relationship [post can have many likes created by many users]