Skip to content

Database Schema

Daniel Upchurch edited this page Feb 19, 2021 · 5 revisions

Schema for PostgresQL

Users

column name data type details
id integer not null, primary key
username string not null, indexed, unique
email string not null, indexed, unique
phoneNumber integer
hashedPassword string not null
firstName string not null
lastName string not null
isOrg boolean default false
createdAt datetime not null
updatedAt datetime not null
  • unique index on username
  • unique index on email
  • User belongsToMany Resources through Claim-Status
  • User hasMany Resources association on posterID

Resources

column name data type details
id integer not null, primary key
posterId integer not null, foreign key
name string not null
description text not null
image string
quantity integer not null
catName string not null
startsAt date not null
endsAt date not null
locationId integer not null, foreign key
createdAt datetime not null
updatedAt datetime not null
  • Resource belongsTo User on posterId
  • Resource belongsToMany Users through Claim-Status
  • Resource belongsTo Location on locationId

Location

column name data type details
id integer not null, primary key
state string not null
city string not null
latitude decimal not null
longitude decimal not null
createdAt datetime not null
updatedAt datetime not null

Claim-Status (Join Table)

column name data type details
id integer not null, primary key
claimUserId integer not null, foreign key
resourceId integer not null, foreign key
quantitiy integer not null
Clone this wiki locally