Skip to content

Database Schema

Duncan Murchison edited this page Dec 4, 2022 · 7 revisions

PostgreSQL Database Schema

users

column name data type details
id integer not null, primary key
email string not null, indexed, unique
encrypted_password string not null
reset_password_token string not null
session_token string not null, indexed, unique
reset_session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • index on email, unique: true
  • index on reset_password_token, unique: true
  • has_many listings
  • has_many reviews

listings

column name data type details
id integer not null, primary key
title string not null
description text not null
photos data not null
author_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • belongs_to user
  • has_many reviews
Clone this wiki locally