schema - ppondo/Uncorkd GitHub Wiki
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 |
profile_photo |
string | optional |
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
Checkins
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
body |
string | not null |
rating |
float | not null, range 1-5 |
photo |
string | optional |
author_id |
integer | not null, indexed, foreign key |
beverage_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
author_id
referencesusers
beverage_id
referencesbeverages
- index on
author_id
,beverage_id
Beverages
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
style |
string | not null |
ABV |
float | not null |
description |
text | not null |
photo |
string | optional |
brewery_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
brewery_id
referencesbrewery
- index on
brewery_id
,name
Brewery
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
location |
string | not null |
description |
text | not null |
photo |
string | optional |
created_at |
datetime | not null |
updated_at |
datetime | not null |