Hi. I have designed the database used for my travel plan application.
You should be able to look at the diagram in the link below, hopefully.
("belongs_to" is omitted since it's obvious)
Basically, the application can list the destinations from a choice of
Not mention that the departure_id (integer) and destination_id (integer)
should not appear but the "city.name" must appear for the users.
Each "Plan" will find both Departure and Destination implicitly and the
only corresponding City.name 's must show up on the screen.
In order to save the database space, I detach the city name (string)
from both departures and destinations, dealing with the connections
among them by id's.
It works. But I am wondering if there are better ways to do it. The
logic becomes rather complex and inevitably the database workload will
be troublesome(?), I suppose.
So what do you think?