-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
Nikhil Kumar edited this page Jun 19, 2022
·
14 revisions
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
email |
string | not null, indexed, unique |
phone |
string | not null |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- indexed on
name,email, andsession_token - foreign key:
has_many listings - foreign key:
has_many saved_listings - foreign key:
has_many appointments - foreign key:
has_many notes
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed, unique |
location |
string | not null, indexed, unique |
neighborhood |
string | not null, indexed |
zip |
integer | not null, indexed |
rent? |
boolean | default false |
own? |
boolean | default false |
type |
string | indexed |
realtor_id |
integer | not null, indexed |
price |
integer | not null |
beds |
integer | indexed |
bath |
integer | indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- indexed on
location, neighborhood, zip, type, beds, bath -
realtor_idreferencesuser has_many appointmentsbelongs_to realtor
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
listing_id |
string | not null, indexed |
user_id |
string | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- indexed on
listing idanduser_id - foreign key:
belongs_to listing - foreign key:
belongs_to user
| column name | datatype | details |
|---|---|---|
| id | integer | not null, primary key |
| listing_id | string | not null, indexed |
| realtor_id | string | not null, indexed |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- indexed on
listing idanduser_id -
realtor_idreferencesuser - foreign key:
belongs_to listing - foreign key:
belongs_to user