I am building a blog application and I have
Post
, City
, Neighbourhood
, SubNeighbourhood
.
The relations that I have until now are between City
, Neighbourhood
and subNeighbourhood
like follows:
subNeighbourhood belongs to Neighbourhood
Neighbourhood belongs to city
The second relation is like
City hasMany Neighbourhoods
Neighbourhood hasMany subNeighbourhoods
My problems are when I create the post. The posts table have id_city
, id_neighbourhood
and id_subNeighbourhood
.
The questions that I have are:
If the post structure is correct? I feel like having many "id_..." is not ok.
Second issue is how do I write the relation in posts? All the columns "id_..." are having foreign keys to each corresponding table.