Skip to content
Erica Thompson edited this page Dec 12, 2020 · 22 revisions

Postgres Database Schema

users

column name data type details
id integer not null, primary key
username string not null, indexed, unique
password_digest string not null
session_token string not null, indexed, unique
type string not null
link string
bio text
location string
created_at datetime not null
updated_at datetime not null
  • index on username, unique: true
  • index on session_token, unique: true

items

column name data type details
id integer not null, primary key
owner_id integer not null, indexed, foreign key
title string not null, indexed, unique
genre string not null
price string not null
released boolean not null
about text not null
collection_id integer
created_at datetime not null
updated_at datetime not null
  • owner_id references users
  • index on owner_id

stories

column name data type details
id integer not null, primary key
author_id integer not null, foreign key
title string not null
body text not null
category string not null
tags array
  • author_id references users
  • index on author_id
Clone this wiki locally