Skip to content
Schploink edited this page May 27, 2021 · 4 revisions

Postgres Database Schema

users

column name data type details
id integer 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

Sounds

column name data type details
id integer not null, primary key
description string not null
uploader_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • uploader_id references users
  • index on uploader_id

comments

column name data type details
id integer not null, primary key
user_id integer not null, indexed, foreign key
sound_id integer not null, indexed, foreign key
sound_timestamp string not null
created_at datetime not null
updated_at datetime not null
  • user_id references users
  • sound_id references sounds
  • index on [sound_id, :user_id], unique: true
Clone this wiki locally