Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.
Alex L edited this page Apr 11, 2023 · 7 revisions

Schema

This includes the database tables and their workings. The database will use PostgreSQL

users

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 datatime 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 liked_gigs

  • has_many gigs (gigs they sell)

  • has_many reviewed_gigs

gigs

column name data type details
id bigint not null, indexed, unique
seller_id bigint not null, indexed, unique
title string not null
description text not null
base_price integer not null, indexed
created_at datatime not null
updated_at datetime not null
  • seller_id references users

  • index on seller_id, unique: true

  • index on base_price

  • has_many: likes

  • belongs_to: seller

likes

column name data type details
id bigint not null, indexed, unique
gig_id bigint not null, indexed, unique
liker_id bigint not null, indexed, unique
created_at datatime not null
updated_at datetime not null
  • index on gig_id, unique: true

  • index on liker_id, unique: true

  • belongs to: user

reviews

column name data type details
id bigint not null, indexed, unique
review_rating integer
communication_rating integer
recommend_rating integer
service_rating integer
gig_id bigint not null, indexed, unique (temporarily not included)
reviewer_id bigint not null, indexed, unique
body text not null
created_at datatime not null
updated_at datetime not null
  • index on gig_id, unique: true`

  • index on reviewer_id, unique: true

  • belongs to: user

  • belongs to: gig

Clone this wiki locally