如何设计最佳的数据库设计来处理订阅及其使用

时间:2022-10-03 23:35:14

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

设计数据库来处理订阅的最佳解决方案是什么

E.g I have subscription plans which consists of :

E。g I的认购计划包括:

  • Price

    价格

  • Validity : e.g 6 months, 1 Month

    有效性:e。g 6个月,1个月

  • Credits : E.g 100, 1 Credit/Booking
  • 学分:E。100 g,1信贷/预订

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

如何跟踪用户订阅的使用和维护历史记录。管理续订/过期计划

1 个解决方案

#1


2  

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

    CustomerSubscriptionHistory

  7. Credit types

    信贷类型

  8. CustomerCredits (references customer & credit types)

    客户信用(参考客户及信用类型)

  9. CustomerCreditHistory

    CustomerCreditHistory

  10. Invoice ( reference customer)

    发票(参考客户)

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

    付款类型(现金、卡、比特币等)

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

    PaymentHistory(可以在表1中跟踪失败和成功)

I have listed the entities based on my understanding, HTH

根据我的理解,我列出了这些实体

#1


2  

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

    CustomerSubscriptionHistory

  7. Credit types

    信贷类型

  8. CustomerCredits (references customer & credit types)

    客户信用(参考客户及信用类型)

  9. CustomerCreditHistory

    CustomerCreditHistory

  10. Invoice ( reference customer)

    发票(参考客户)

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

    付款类型(现金、卡、比特币等)

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

    PaymentHistory(可以在表1中跟踪失败和成功)

I have listed the entities based on my understanding, HTH

根据我的理解,我列出了这些实体