I am prototyping a system that will allow users to book and pay for a connection on a charging station for their EVs in a certain location.

Business rules

  • they can book a connection for as long as they want
  • they can reduce, extend or ask for refund.
  • it could be possible that a booking doesn't have a transaction because there can be cases where we just want to turn on a connection for a user for free or if there's a promo.
  • can add a new site with stations and connections (rarely).
  • when a user selects a connection but doesn't pay for it, it has a 15-minute hold before it is released to be available again. I am planning to put this connection holds on redis for easier access instead of having another table for hold connections.

Here is the DB model I have so far. I am unsure how to connect site, station, and connection to the booking table. Should I just denormalize the 3 tables (site, station, and connection) into a table called 'connection'? since this is rarely updated or we rarely add a new site.

enter image description here

  • 1
    in you booking table remove site_id and station_id and leave connection_id then join booking to connection, in other words a connection can have many bookings but a booking can only have one connection. you will need some sort of customer model with a join from booking to customer – RegBes Jun 3 at 14:10
  • What is the difference between "Booking for 15 minutes" (requirement 1) and "Reserving a Connection" (requirement 5)? and what/where is "redis"? – Michael Kutz Jun 4 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.