-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Anton James edited this page May 25, 2023
·
8 revisions
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
username |
string | not null, indexed, unique |
email |
string | not null, indexed, unique |
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 games_in_cartthroughcart_items has_many :gameshas_many :reviews
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
title |
string | not null, indexed, unique |
price |
float | not null |
genre |
string | not null |
details |
text | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
title,unique: true has_many :reviews
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
user_id |
string | not null, foreign key, indexed |
game_id |
float | not null, foreign key, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreference touser -
game_idreference togame - index on
[:game_id, :user_id], unique: true has_many :gamesbelongs_to :user
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
user_id |
string | not null, foreign key, indexed |
game_id |
float | not null, foreign key, indexed |
recommended |
boolean | not null |
comment |
text | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreference touser -
game_idreference togame - index on
[:game_id, :user_id], unique: true belongs_to :gamebelongs_to :user
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
user_id |
string | not null, foreign key, indexed |
game_id |
float | not null, foreign key, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreference touser -
game_idreference togame - index on
[:game_id, :user_id], unique: true