Airbnb Database_Design
Ruby on Rails - 5.1.6
mysql2 - 0.3.18
has_many :messages, :favorite_lists,:listing_photos, :home_reservations, :home_reviews
belongs_to :country, :language, :currency
Column |
Type |
Options |
name |
string |
null: false, index: true |
birth_day |
date |
null: false |
sex |
enum |
null: false |
phone_number |
string |
null: false, unique: true |
postal_code |
string |
null: false |
country_id |
references |
null: false, foreign_key: true |
prefecture |
string |
null: false |
town |
string |
null: false |
street |
string |
null: false |
building |
string |
null: false |
self_introduction |
text |
null: false |
status |
enum |
null: false |
superhost |
enum |
default: 0 |
currency_id |
references |
null: false,foreign_key: true |
language_id |
references |
null: false, foreign_key: true |
has_many :favorites, :home_reservations, :home_reviews, :additional_home_rules
belongs_to :home_category_sub, :room_type, :country, :currency
has_one :amenity, :bed_type, :available_spaces, :overview, :available_setting, :price, :home_rule, :additional_home_rule, :home_notification
has_and_belongs_to_many :listing_photos
Column |
Type |
Options |
capacity |
integer |
null: false |
number_of_bedrooms |
integer |
null: false |
number_of_bathrooms |
integer |
null: false |
bathroom_for_guest |
boolean |
null: false |
postal_code |
string |
null: false |
country_id |
references |
null: false, foreign_key: true, index: true |
prefecture |
string |
null: false |
town |
string |
null: false, index: true |
street |
string |
null: false |
building |
string |
null: false |
location_x |
integer |
null: false |
location_y |
integer |
null: false |
name |
string |
null: false, index: true |
home_category_sub_id |
references |
null: false, foreign_key: true |
room_type_id |
references |
null: false, foreign_key: true |
Column |
Type |
Options |
user_id |
references |
null: false, foreign_key: true |
home_id |
references |
null: false, foreign_key: true |
checkin_date |
datetime |
null: false |
checkout_date |
datetime |
null: false |
number_of_guests |
integer |
null: false |
created_at |
timestamps |
|
accomodation_fee |
integer |
null: false |
cleaning_fee |
integer |
null: false |
service_fee |
integer |
null: false |
total_price |
integer |
null: false |
belongs_to :home, :user, :home_reservation
Column |
Type |
Options |
user_id |
references |
null: false |
home_id |
references |
null: false, foreign_key: true |
home_reservation_id |
references |
null: false |
review |
text |
null: false |
accuracy_rate |
integer |
null: false |
location_rate |
integer |
null: false |
communication_rate |
integer |
null: false |
cleanliness_rate |
integer |
null: false |
checkin_rate |
integer |
null: false |
cost_performance_rate |
integer |
null: false |
has_and_belongs_to_many :homes
Column |
Type |
Options |
user_id |
references |
null: false, foreign_key: true |
image |
text |
null: false |
Column |
Type |
Options |
name |
string |
null: false |
Column |
Type |
Options |
single_bed |
integer |
|
double_bed |
integer |
|
queen_bed |
integer |
|
sofa_bed |
integer |
|
home_id |
references |
null: false, foreign_key: true |
Column |
Type |
Options |
name |
string |
null: false |
Column |
Type |
Options |
necessities |
boolean |
|
wifi |
boolean |
|
shampoo |
boolean |
|
closet |
boolean |
|
tv_set |
boolean |
|
heating |
boolean |
|
air_conditioner |
boolean |
|
breakfast |
boolean |
|
desk |
boolean |
|
fireplace |
boolean |
|
iron |
boolean |
|
hair_dryer |
boolean |
|
allowed_pet |
boolean |
|
smoke_detector |
boolean |
|
carbon_monoxide_detecter |
boolean |
|
aid_set |
boolean |
|
fire_extinguisher |
boolean |
|
disaster_card |
boolean |
|
keyed_door |
boolean |
|
home_id |
references |
null:false, foreign_key: true |
Column |
Type |
Options |
dedicated_living |
boolean |
|
pool |
boolean |
|
kitchen |
boolean |
|
washer_machine |
boolean |
|
washer_dryer_machine |
boolean |
|
parking |
boolean |
|
elevator |
boolean |
|
jacuzzi |
boolean |
|
gym |
boolean |
|
home_id |
references |
null:false, foreign_key: true |
Availability_settings_table
Column |
Type |
Options |
reservation_deadline |
integer |
|
checkin_time_deadline_from |
time |
|
checkin_time_deadline_to |
time |
|
acceptable_month_ahead |
integer |
|
muximum_accomodation_range |
integer |
|
minimum_accomodation_range |
integer |
|
home_id |
references |
null:false, foreign_key: true |
Column |
Type |
Options |
pricing_method |
enum |
null: false |
default_price |
integer |
null: false |
muximum_price |
integer |
|
minimum_price |
integer |
|
first_arrival_discount |
boolean |
|
weekly_discount_rate |
float |
null: false |
monthly_discount_rate |
float |
null: false |
cleaning_fee |
integer |
null: false |
deposit |
integer |
null: false |
additional_fee_per_person |
integer |
null: false |
home_id |
references |
null:false, foreign_key: true |
Column |
Type |
Options |
accept_kids |
boolean |
|
kids_reason |
text |
|
accept_babies |
boolean |
|
babies_reason |
text |
|
accept_pet |
boolean |
|
accept_smoking |
boolean |
|
accept_event_party |
boolean |
|
home_id |
references |
null: false, foreign_key: true |
Additional_home_rules_table
Column |
Type |
Options |
content |
text |
null: false |
home_id |
references |
null: false, foreign_key: true |
Column |
Type |
Options |
only_stairs |
boolean |
|
stairs_detail |
text |
|
noisy |
boolean |
|
noisy_detail |
text |
|
pet_stayed |
boolean |
|
pet_detail |
text |
|
no_parking |
boolean |
|
parking_guide |
text |
|
shared_space |
boolean |
|
shared_space_detail |
text |
|
limited_amenity |
boolean |
|
limited_amenity_detail |
text |
|
surveillance_camera |
boolean |
|
camera_detail |
text |
|
firearm |
boolean |
|
firearm_detail |
text |
|
dangerous_animals |
boolean |
|
animals_detail |
text |
|
home_id |
references |
null: false, foreign_key: true |
has_and_belongs_to_many :home_category_subs
Home_category_mains_table
Column |
Type |
Options |
name |
string |
|
has_and_belongs_to_many :home_category_mains
Column |
Type |
Options |
name |
string |
|
Column |
Type |
Options |
user_id |
references |
null: false, foreign_key: true |
name |
string |
|
Column |
Type |
Options |
sender_user_id |
references |
null: false, foreign_key: true |
recipient_user_id |
references |
null: false, foreign_key: true |
text |
text |
|
created_at |
timestamps |
|
Column |
Type |
Options |
home_id |
references |
null: false, foreign_key: true |
overview |
text |
null: false |
about_listing |
text |
|
areas_available |
text |
|
communication_frequency |
text |
|
other_notices |
text |
|
area_information |
text |
|
transportation |
text |
|
Column |
Type |
Options |
name |
string |
|
Column |
Type |
Options |
name |
string |
|
Listing_photo_homes_table
Column |
Type |
Options |
home_id |
references |
null: false, foreign_key: true |
listing_photo_id |
references |
null: false, foreign_key: true |
Home_category_main_subs_table
Column |
Type |
Options |
home_category_main_id |
references |
null: false, foreign_key: true |
home_category_sub_id |
references |
null: false, foreign_key: true |