-
Notifications
You must be signed in to change notification settings - Fork 2
Database Schema
Deborah Wei edited this page Aug 5, 2022
·
5 revisions
| column | data type | details |
|---|---|---|
id |
integer | not null, primary key |
username |
string | not null, indexed, unique |
name |
string | not null |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
username, unique: true - index on
email, unique: true - index on
session_token, unique: true has_many pinshas_many boardshas_many followershas_many followings
| column | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
user_id |
integer | not null, indexed, foreign_key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id has_many pinsbelongs_to user
| column | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
user_id |
integer | not null, indexed, foreign_key |
| description | body | |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id belongs_to user
| column | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign_key |
pin_id |
integer | not null, indexed, foreign_key |
text |
body | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id - index on
pin_id belongs_to userbelongs_to pin
| column | data type | details |
|---|---|---|
id |
integer | not null, primary key |
follower_id |
integer | not null, indexed, foreign_key |
following_id |
integer | not null, indexed, foreign_key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
follower_id - index on
following_id - index on
[:follower_id, :following_id], unique: true belongs_to user