Amit Patel
Amit Patel

Reputation: 15985

Database Design : Creating database and User Interface for recurring events

We are creating web-application of a bus service where people search and book the seat. We want to give a UI to admin where s/he can specify recurring trips.

For example Volvo Bus will run from City1 to City2 every day 9:00 AM except Tuesday. There can be any number of such criteria.

How should I store such different recurring trips which can be searched without perfomance hit? How should it be representd in UI which is easy for admin to work with.

Current Database Design:

Table : TRIP_MASTER
TRIP_ID
NAME

Table : TIMETABLE
ID
TRIP_ID
CITY_ID
ARRIVAL_TIME
DEPARTURE_TIME
SEQ_NO

Upvotes: 0

Views: 790

Answers (1)

Tim
Tim

Reputation: 5421

Your options are a) to store entities representing each occurrence of the recurring trip (as you might populate a calendar table with a row representing each day of the year), an approach that leverages SQL or b) store a rule representing the recurring schedule, which will require more procedural code throughout the application. I favor option a), even though it requires routines to populate the trip-occurrences table on a periodic basis.

Upvotes: 2

Related Questions