-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
grantpaulson6 edited this page Apr 30, 2019
·
13 revisions
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| username | string | not null, unique, indexed |
| password_digest | string | not null |
| session_token | string | not null, unique, indexed |
| first_name | string | not null |
| last_name | string | not null |
| string | not null, unique, indexed | |
| gender | string | inclusion (male, female, other) |
| birthdate | date | |
| about | text | |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on username, unique: true
- index on session_token, unique: true
- index on email, unique: true
- has_many bookings
- has_many nests through bookings
- has_many hosts through nests
- has_many listings
- has_many listing_bookings through listings
- has_many customers through listing_bookings
- has_many reviews, as reviewable
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| title | string | not null, unique, indexed |
| price | float | not null |
| location_id | integer | not null, inclusion (list of locations) |
| description | text | not null |
| type | string | not null, inclusion (list of types) |
| owner_id | integer | not null |
| max_guests | integer | not null |
| num_beds | integer | not null |
| num_bathrooms | integer | not null |
| street_address | string | not null |
| zip_code | integer | not null |
| lat | float | not null |
| lng | float | not null |
- index on title, unique: true
- has_many bookings
- belongs_to location
- belongs_to owner
- has_many reviews, as reviewable
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| name | string | not null |
| lat | float | not null |
| lng | float | not null |
- has_many listings
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| listing_id | integer | not null |
| nomad_id | integer | not null |
| start_date | date | not null |
| end_date | date | not null |
- belongs_to listings
- belongs_to nomad
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| author_id | integer | not null |
| reviewable | reference | not null, polymorphic, indexed |
| score | integer | not null, inclusion (0, 1, 2, 3, 4, 5) |
| review | text | not null, min characters |
- references :reviewable, polymorphic: true, index: true
- belongs_to author
- belongs_to reviewable, polymorphic: true