Skip to content
killacan edited this page Sep 6, 2022 · 1 revision

Tables

users

column name data type details
id Bigint not null, primary key
username String not null, uniqueness true, indexed
password_digest String not null
email String not null, uniqueness true
session_token String not null, uniqueness true, indexed
created_at Date not null
Updated_at Date not null
  • index on username, unique: true
  • index on email, unique: true
  • index on session_token, unique: true
  • has_many games
  • has_many reviews

games

column name data_type validations
id Bigint not null, primary key
game_name String not null, uniqueness true, indexed
uploader_id Bigint not null
created_at Date not null
Updated_at Date not null
  • index on game_name
  • uploader_id references users
  • has_many owners
  • has_many tags

reviews

column name data_type validations
id Bigint not null, primary key
body String not null
reviewer_id Bigint not null, indexed
created_at Date not null
Updated_at Date not null
  • reviewer_id references users
  • belongs_to user

cart_items

column name data_type validations
id Bigint not null, primary key
user_id Bigint not null, indexed
game_id Bigint not null, indexed
created_at Date not null
Updated_at Date not null
  • user_id references users
  • game_id references games
  • has_many users
  • has_many games

game_tags

column name data_type validations
id Bigint not null, primary key
tag_id Bigint not null, indexed
game_id Bigint not null, indexed
created_at Date not null
Updated_at Date not null
  • tag_id references tags
  • game_id references games
  • belongs_to game
  • belongs_to tag

tags

column name data_type validations
id Bigint not null, primary key
tag string not null,
created_at Date not null
Updated_at Date not null
  • has_many games

user_games

column name data_type validations
id Bigint not null, primary key
user_id Bigint not null, indexed
game_id Bigint not null, indexed
created_at Date not null
Updated_at Date not null
  • user_id references users
  • game_id references games
  • belongs_to user
  • belongs_to game

Clone this wiki locally