S
S
stepan-neretin72020-01-19 17:05:54
Database design
stepan-neretin7, 2020-01-19 17:05:54

How to competently make the architecture of the Country-> region-> city?

Hello guys
I have a question for you about architecture.. How can I do it better...?
I have a task to make something like a simple bulletin board . The
trick is that I need to competently make sure that the user has his city saved in his profile, but each city has its own region -> country
And so that in the user model I would I was able to pull this whole chain
. How can I do it better?
But the trick is that the ad can also have a city that has a region that has a country
and so that I can again get the city, region, country of the ad
My guess ... Make a multilayer One to many, what do you think?
So that later in the User model, or in the announcement model, I can easily pull out the entire chain

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Antonio Solo, 2020-01-19
@solotony

region->country
city->region
user->city
listing->city
listing->user

V
Vladimir Korotenko, 2020-01-19
@firedragon

What is the problem? Pass these 6 properties, in tables use ISO code as primary code and ZIP for region, or index
countryId
country
regionId
region
cityId
city

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question