0

I am trying to implement a booking system for charging stations that can either extend or refund a booking. I basically have the following tables:

  • booking
  • booking_logs
  • payment
  • refunds

With how the 3rd party payment system we are using is set up, the refunds are attached to payments. Meaning a payment can have multiple refunds, but refunds only belong to one payment.

Now I want to log those actions as I want to be able to display the history of what went on in a single booking. Because a user can extend as many times as they want and we can also refund them if for some reason the charging didn't go well.

Here is my ERD so far.

I just want to know if what I am doing with the booking_logs is okay. I have read about Polymorphic Associations but I don't think it would apply to me as payment and refund have a 1:M relationship and even if they didn't, it seems like it is not always advised to use Polymorphic Associations.

Please correct me if Im wrong. enter image description here

3
  • What else might booking_log be related to? What is your doubt? Commented Aug 27, 2019 at 5:38
  • @LaurenzAlbe nothing else. It is just all the history of what happens in a booking.
    – ellaRT
    Commented Aug 27, 2019 at 18:36
  • Then I see nothing wrong with the layout. Commented Aug 28, 2019 at 6:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.