Database Schema - ARGON90/BadReads GitHub Wiki
users
column name |
data type |
details |
id |
integer |
not null, primary key |
username |
string |
not null |
email |
string |
not null, unique |
password |
string |
not null |
created_at |
datetime |
not null |
updated_at |
datetime |
not null |
books
column name |
data type |
details |
id |
integer |
not null, primary key |
user_id |
integer |
not null, foreign key |
bookshelf_id |
integer |
not null, foreign key |
title |
string |
not null |
year |
integer |
not null |
author |
string |
not null |
description |
string |
not null |
img_url |
string |
not null |
banned |
string |
not null |
created_at |
datetime |
not null |
updated_at |
datetime |
not null |
user_id
references users
table
book_id
references books
table
bookshelf_id
references bookshelves
table
bookshelves
column name |
data type |
details |
id |
integer |
not null, primary key |
user_id |
integer |
not null, foreign key |
book_id |
list |
foreign key |
default |
boolean |
not null |
name |
string |
not null, unique |
user_id
references users
table
book_id
references books
table
books & bookshelves join table
column name |
data type |
details |
book_id |
integer |
not null, foreign key |
bookshelf_id |
integer |
not null, foreign key |
book_id
references books
table
bookshelf_id
references bookshelves
table
reviews
column name |
data type |
details |
id |
integer |
not null, primary key |
user_id |
integer |
not null, foreign key |
book_id |
integer |
not null, foreign key |
review |
string |
not null |
stars |
integer |
not null |
created_at |
datetime |
not null |
updated_at |
datetime |
not null |
user_id
references users
table
book_id
references books
table