简体   繁体   中英

How to Design Optimal Database Design to Handle Subscription And Its Usage

What would be a optimal solution to design database to handle Subscriptions

Eg I have subscription plans which consists of :

  • Price

  • Validity : eg 6 months, 1 Month

  • Credits : Eg 100, 1 Credit/Booking

How to track the usage and maintain history of the user's subscriptions.
Manage Renewals / Expire Plans

You should have the following tables

  1. Customers

  2. Subscriptions

  3. Price plans (references subscription)

  4. Price plan line items (references price plan)

  5. Customersubscriptions (references customers and subscription)

  6. CustomerSubscriptionHistory

  7. Credit types

  8. CustomerCredits (references customer & credit types)

  9. CustomerCreditHistory

  10. Invoice ( reference customer)

  11. PaymentTypes (cash, card, bitcoins etc...)

  12. PaymentHistory (can track failure & success in 1 table)

I have listed the entities based on my understanding, HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM