Note that there are some explanatory texts on larger screens.

plurals
  1. POPerformance issues with complex nested RoR reservation system
    primarykey
    data
    text
    <p>I'm designing a Ruby on Rails reservation system for our small tour agency. It needs to accommodate a number of things, and the table structure is becoming quite complex. </p> <p>Has anyone encountered a similar problem before? What sort of issues might I come up against? And are performance/ validation likely to become issues?</p> <p>In simple terms, I have a customer table, and a reservations table. When a customer contacts us with an enquiry, a reservation is set up, and related information added (e.g., paid/ invoiced, transport required, hotel required, etc).</p> <p>So far so good, but this is where is gets complex. Under each reservation, a customer can book different packages (e.g. day trip, long tour, training course). These are sufficiently different, require specific information, and are limited in number, such that I feel they should each have a different model.</p> <p>Also, a customer may have several people in his party. This would result in links between the customer table and the reservation table, as well as between the customer table and the package tables. </p> <p>So, if customer A were to make a booking for a long trip for customers A,B and C, and a training course for customer B, it would look something like this.</p> <pre><code>CUSTOMERS TABLE CustomerA CustomerB CustomerC CustomerD CustomerE etc RESERVATIONS TABLE 1. CustomerA LONG TRIP BOOKINGS CustomerA - Reservation_ID 1 CustomerB - Reservation_ID 1 CustomerC - Reservation_ID 1 TRAINING COURSE BOOKINGS CustomerB - Reservation_ID 1 </code></pre> <p>This is a very simplified example, and omits some detail. For example, there would be a model containing details of training courses, a model containing details of long trips, a model containing long trip schedules, etc. But this detail shouldn't affect my question.</p> <p>What I'd like to know is: </p> <p>1) are there any issues I should be aware of in linking the customer table to the reservations model, as well as to bookings models nested under reservations.</p> <p>2) is this the best approach if I need to handle information about the reservation itself (including invoicing), as well as about the specific package bookings.</p> <p>On the one hand this approach seems to be complex, but on the other, simplifying everything into a single package model does not appear to provide enough flexibility. </p> <p>Please let me know if I haven't explained this issue very clearly, I'm happy to provide more information. Grateful for any ideas, suggestions or comments that would help me think through this rather complex database design.</p> <p>Many thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload