-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Rupa Dhillon edited this page Aug 11, 2019
·
2 revisions
All tables include date-time columns for created_at and updated_at, which are not shown below. Active Storage tables are not listed below.
Benches
Column | Data Type | Required | Default |
---|---|---|---|
description | string | yes | N/A |
lat | float | yes | N/A |
lng | float | yes | N/A |
seating | integer | yes | N/A |
num_reviews | integer | no | 0 |
review_total | integer | no | 0 |
Reviews
Column | Data Type | Required | Default |
---|---|---|---|
user_id | integer | yes | N/A |
bench_id | integer | yes | N/A |
rating | integer | yes | N/A |
comment | string | yes | N/A |
Users
Column | Data Type | Required | Default |
---|---|---|---|
username | string | yes | N/A |
password_digest | string | yes | N/A |
session_token | string | yes | N/A |
Benches: No constraints.
Reviews: A user may only review a bench once.
Users: Session token and username must be unique.
The benches table manually caches the number of total reviews and the total review score per bench. These values are updated any time a review is submitted. If a review is destroyed (only doable via backend currently), the bench table will be updated via the Review model's before_destroy action.
If users are allowed to edit their review ratings, necessary methods will need to be added either to the model or the controller.