-
Notifications
You must be signed in to change notification settings - Fork 0
database schema
Arebiter edited this page Nov 2, 2021
·
27 revisions
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| string | not null, indexed, unique | |
| password_digest | string | not null |
| session_token | string | not null, indexed, unique |
| first_name | string | not null |
| last_name | string | |
| bio | text | |
| 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
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| location | string | not null |
| start_time | datetime | not null |
| end_time | datetime | not null |
| city_id | integer | not null, indexed, foreign key |
| host_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on
host_id, unique:true - index on
city_id, unique: true -
host_idreferencesusers -
city_idreferencescities
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| city_name | string | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on
name, unique:true
to keep track of users attending a teatime
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| teatime_id | integer | not null, indexed, foreign key |
| user_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on
[teatime_id, user_id]. unique: true- this would need to be a unique combination -
teatime_idreferencestea_times -
user_idreferencesusers
to show reviews of a host
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| user_id | integer | not null, indexed, foreign key |
| host_id | integer | not null, indexed, foreign key |
| rating | integer | not null |
| review | text | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on
[user_id, host_id]. unique: true- this would need to be a unique combination - a user can only review a host once? -
user_idreferencesusers -
host_idreferencesusers - a host can be reviewed, the review belongs to the user who makes the review