Skip to content

Postgres Database Schema

Jacob Prall edited this page Aug 20, 2020 · 9 revisions

users

column name data type details
id integer not null, unique
email string not null, indexed, unique
p_num string not null, unique
password_digest string not null
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • Associations
    • has many accounts
    • has many goals through accounts
    • has many bills
    • has many transactions through accounts

accounts

column name data type details
id integer not null, unique
debit boolean not null
account_category string not null
institution string not null
label string not null
balance float not null
user_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • Associations
    • belongs to user
    • has many transactions
    • has many goals

transactions

column name data type details
id integer not null, unique
account_id integer not null, indexed, foreign key
amount float not null
description string not null
transaction_category string not null
tags string
date string not null
created_at datetime not null
updated_at datetime not null
  • Associations
    • Belongs to account

goals

column name data type details
id integer not null, unique
account_id integer not null, indexed, foreign key
goal_category string not null
title string not null
notes string
amount integer not null
target_date datetime
created_at datetime not null
updated_at datetime not null
  • Associations
    • Belongs to account

bills

column name data type details
id integer not null, unique
name string not null
details string not null
amount float not null
recurring boolean not null
due_date string not null
paid boolean not null
user_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • Associations
    • Belongs to user
Clone this wiki locally